Thursday, March 01, 2012

The secret core FTP command line switches cheat sheet

 I  am always looking for the below.

Command Line
Download a file via a FTP URL (see FTP URL's for more information).

From the command line, type:

drive:\(coreftp path)\coreftp.exe -d


drive:\(coreftp path)\coreftp.exe

This will download the file into the default download directory specified in options, or to the last local directory that was used while in the program.

If you don't want the GUI to pop up, add the -s (silent) option to your command line parameters.

To use a different destination directory, include: -p drive:\directory

drive:\(coreftp path)\coreftp.exe -d -p drive:\path\

Wildcard support was added as of build 1250.

drive:\(coreftp path)\coreftp.exe -d*.jpg -p drive:\path\

To rename the destination filename, use -FN

Upload a file:

From the command line, type:

drive:\(coreftp path)\coreftp.exe -u c:\path\yourfileorpath\filename

drive:\(coreftp path)\coreftp.exe -u c:\path\yourfileorpath\*.jpg

This will upload the file or path specified into the directory specified by the URL. Make sure the URL has all appropriate userid/password/permissions for the remote FTP server.

To use a different desination directory, use the -p /directory/: (example with site profile).

drive:\(coreftp path)\coreftp.exe -site mysite -u c:\path\yourfile\file.dat -p /remotedir/

Blocking Transfers:

By default Core FTP command line works asynchronously.

To block transfers during processing, use the 'corecmd.exe' utility with the normal command line parameters.

SSL Options:

-ssl-- AUTH SSL

-tls-- AUTH TLS

-ssldirect-- Direct SSL (implicit)

-winssl-- Use Windows security layer (OpenSSL by default)

SSH/SFTP Options:

-SSH or sftp:// in the URL...

Log screen output to a file:


Log directory information to a file:


Process a template:

drive:\(coreftp path\coreftp.exe -t templatename

Add -refresh to reload template file sizes.

Transferring using a site profile:

If you need to use special settings like SSL or SSH, create a site profile in the Site Manager and then use the following command line parameter.

Use: -site profilename


Download: drive:\(coreftp path)\coreftp.exe -site mysite -d /directory/yourfile.dat -p c:\download\

Upload: drive:\(coreftp path)\coreftp.exe -site mysite -u c:\myfile.dat -p /public_htm/mydirectory/

Overwrite and resume options:

Use:-O-- Overwrite if file exists

-OA-- Overwrite *all* if transfering a folder or directory of files.

-ON-- Overwrite files that are newer than existing files.

-OG-- Overwrite destination file if source file size is greater.

-OL-- Overwrite destination file if source file size is less (smaller).

-OS-- Skip file if exists

-R -- Resume if file exists

-RA-- Resume *all* files that exist.

Transfer oldest/newest files

-newest -- Transfer the newest file in a directory.

-oldest -- Transfer the newest file in a directory.

ie: c:\(coreftp path)\corecmd.exe -s -oldest -site mysite -d /remote_path/*.txt -p c:\localdir\ To download the oldest file in a directory.

Compress and upload a file (Pro only):

drive:\(coreftp path)\coreftp.exe -O -ZIP -AUTONAME -u c:\IBM -site siteprofile -p /public_html/uploadpath/

-AUTONAME automatically names the file. Without this parameter the file will be named Use -FN to specify destination.

Local compressing(zip) and decompressing(unzip) of files (Pro only):


ie: coreftp.exe -ZIPONLY password c:\path\ c:\source\*.dat


ie: coreftp.exe -UNZIPONLY password c:\path\ c:\desination\

Override Ascii or Binary mode for transfers:

-A -- for ascii mode

-B-- for binary mode

By default, files are always transfered in binary mode unless specifed in the ascii extensions.

Silent Mode:

Use:-s -- Will transfer file with no GUI except for a transfer dialog and overwrite prompts. In the Pro version, there is no splash screen.

Delete Source File:

Use:-delsrc-- Delete the source file (upload or download) after successful transfer.

-del filespec-- Delete files. Command used alone (no transfers) with site profile or FTP url.

-purge filespec days-- Purge files of x days old. Common used alone with site profile or FTP url.

-rmdir -- To delete a directory

Rename Destination File:

Use:-FN newfilename-- use this to transfer a file to a different filename, used in conjunction with the -p parameter.

-- ie: coreftp.exe -u c:\myfile -p /path/ -FN newfilename

Miscellaneous Commands:

Use:-hide-- Hide the transfer window when not in silent mode.

-show-- Show the transfer window when not in silent mode.

-dir -- Dump directory information into a file. -dir

-dira -- Dump directory information into a file forcing ascii format.

-refresh-- Refresh file sizes in gui if size has changed.

-zip password-- Compress files into destination file with optional password.

-unzip password-- Decompress files into desination directory with optional password.

-ignorenotfound-- Returns no error if a file is not found.

-flash-- Run from an external drive.

-chmod -- Change permissions on a file.

-pasv-- Set transfer channel to passive mode.

-active-- Set transfer channel to active mode.

-nocase -- Ignore case

-ignorenotfound-- Ignores no files found problems on some servers

-recurse-- Recurse subdirectories.

-remotemove /oldpath/*.ext /newpath/ -- Move files remotely from one folder/directory to another

-exit-- Exit override

ie: "c:\program files\coreftp\coreftp.exe" -O -zip -u c:\IBM\*.dat -site siteprofile -p /remote_directory/ -fn

Script Options:

-scbl -- Run script from file before logon

-scal -- Run script from file after logon

-scbt -- Run script from file before transfer

-scat -- Run script from file after transfer

Install Options:

Use:-lic -- To install license file automatically

-Import -- To import a file of sites (previously exported from within the site manager)

-ImportGlobal -- To import a file of sites to be useable by all users (and not editable or deletable).

Output File:

The output file can be used for batch or external program monitoring of transfers.

Use-output \path\filename-- Will output a log file for each transfer.

Format: transfer type (1-download, 2-upload,...), transfer status(1-success, 2-failure, 30-file not found), start time, end time, dest, source.

Environment Variables:

In batch files, the environment variable will contain a transfer's return value in %ERRORLEVEL% (0 or 1, or 30 for file not found). This value is only reliable within a .bat file.


Anonymous said...

Can you provide any full examples of using the -remotemove command? I can't get it to work! Thanks.

Anonymous said...

Very useful, thanks for your time in creating this document!

Anonymous said...

This is awesome. Saved my butt...thanks

Nullsig said...

I am trying to connect to a SFTP server. I have created a site profile and a batch using -site but for some reason the script tries to connect to my local IP.

Then I tried using the -SSH and sftp:// but in the case of the latter it was asking for username and password when I type in sftp://username:password@site/path.
In the case of the former the connection just fails

Any Ideas?

A Critical System said...

Can you connect OK using the Site profile? That is key to make sure it work in GUI first then you can switch to command line.

Nullsig said...

I created the site profile and it connects fine then I use C:\Program Files\CoreFTP\CoreFTP.exe -site CE -d /uploads/*.txt -p

Instead of connecting to the external IP I have designated it connects to the IP address listed for my computer in my internal network.

A Critical System said...

You have to finish the line after the -p c:\yourlocalfolder

Nullsig said...

I did, however i used triangle brackets and it translated it as html.

C:\Program Files\CoreFTP\CoreFTP.exe -site CE -d /uploads/*.txt -p c:\destination\

A Critical System said...

Hmm that looks good, do you have the quotes around the coreftp executable path?

"C:\Program Files\CoreFTP\CoreFTP.exe" -site CE -d /uploads/*.txt -p c:\destination\

Nullsig said...

I only had the quotes around Program files.... That fixed it. Thank you so much

MarkF said...

Can't get the -rmdir to work. I want to del the directories from the local pc after uploading.

MarkF said...

This is what I am using now. Problem is that -delsrc only deletes files and leaves the directories in place.

coreftp.exe -delsrc -s -show -ON -u c:\msiinc\usreport\upload\ sftp://XXXXX:XXXXXX@XXXXXXXX/us/


Having issues with uploading a file i can download fine are there any tricks to that?

Anonymous said...

Can you provide some example of using mapped drives on core FTP ?

Sigmabeta said...

Very useful, but I have difficulties on deleting.
This is my code but it doesn't work in both cases.
Case 1
Call Shell("C:\Programmi\CoreFTP\Corecmd.exe -del filespec -log C:\Temp\a.txt")

Case 2
Call Shell("C:\Programmi\CoreFTP\Corecmd.exe -dele -log C:\Temp\a.txt")

Whe!re is my mistake?

Anonymous said...


I have been running an upload using a command line under Windows XP 32 bit for years with no problems. We switched to Windows 7 32 bit and now the upload does not work. Any advice?

Anonymous said...

Is there any command line to check whether all files on FTP drive have been downloaded, i.e. to check if files are present on FTP?


supakrit r said...

Hi all

i use sftp transfer command but i have problem with private key

in winscp command
open s -privatekey=D:\xxxx\xx\private.ppk

How can i command to add privatekey as winscp?

now i try this command but it doesn't work
"C:\xxx\CoreFTP\coreftp.exe" -show -O -u D:\xx\test1.txt s

Thank you

Drew Holloway said...

Thanks for putting this all together. Very helpful!!!