CoreFTP Command Line commands

Snapshot from their official documentation at 25th of July 2012. Please read the official documentation supplied with the binaries downloadable from the CoreFTP website for the most accurate information. CoreFTP has a summary of command line options in their Docs section.

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 ftp://ftp.yoursite.com/directory/yourfile.dat

or

drive:\(coreftp path)\coreftp.exe ftp://ftp.yoursite.com/directory/yourfile.dat

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 ftp://ftp.yoursite.com/directory/yourfile.dat -p drive:\path\

Wildcard support was added as of build 1250.

drive:\(coreftp path)\coreftp.exe -d ftp://user:password@ftp.yoursite.com/directory/*.jpg -p drive:\path\

To rename the destination filename, use -FN <newfilename>

Upload a file:

From the command line, type:

drive:\(coreftp path)\coreftp.exe -u c:\path\yourfileorpath\filename ftp://ftp.yoursite.com/directory/yourfileorpath/

drive:\(coreftp path)\coreftp.exe -u c:\path\yourfileorpath\*.jpg ftp://user:password@ftp.yoursite.com/directory/yourfileorpath/

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 <outputfile>

Log directory information to a file:

-dir </remote_path/> <outputfile>

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

Examples:

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 IBM.zip. Use -FN to specify destination.

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

-ZIPONLY <optional password> <Full path desination .zip> <Full path to source files>

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

-UNZIPONLY <optional password> <Full path source .zip> <Full path desination path>

ie: coreftp.exe -UNZIPONLY password c:\path\source.zip 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 <remote_directory> <output_filename>

-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 <value>– Change permissions on a file.

-pasv– Set transfer channel to passive mode.

-active– Set transfer channel to active mode.

-nocase — Ignore case

-strip — strips spaces from filename, or specify optional string to strip

-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 myfiles.zip

Script Options:

-scbl <filename>– Run script from file before logon

-scal <filename>– Run script from file after logon

-scbt <filename>– Run script from file before transfer

-scat <filename>– Run script from file after transfer

Install Options:

Use:-lic <filename> — To install license file automatically

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

-ImportGlobal <filename>– 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.

This entry was posted in CoreFTP and tagged , , , , , , , , , , , , , , , , , , , , , , , , , , . Bookmark the permalink.