CryCopy: Examples of use
CryCopy, a free and simple to use command line file copy tool which supports FTP.
Examples of use:
- Publish a website to an FTP server
- To download from an FTP site
- Backup a set of files from a local folder to a network share
- To copy a single specific file from one folder to another
- Copy to an FTP server using a non-standard control port
For most people the GUI tool Web Site Publisher provides an easier method of publishing a website.
Other than the username and password, the following is the script that was once used to update the www.cryer.co.uk website:
CryCopy "C:\Users\Brian\Web\Home Page" ftp:\\www.cryer.co.uk\public_html /u:myusername /p:mypassword /v1 /subs /delete /Errors:C:\Temp\PubCryerErr.log
(The above should be on one line, it may wrap in the browser.) What this done is:
- This is specifying the folder to copy from. In this case it is a local folder. It is enclosed in quotes because the folder path contains a space. Were it not for the space the quotes would not be needed.
- The destination to copy to. The "ftp:\\" section at the start shows that
it is to be copied to an FTP server. In this case "
ftp.cryer.co.uk" is the DSN name for the FTP server, and "
public_html" is a folder on the FTP server into which files are to be copied.
- Specifies the username to use with the FTP connection.
- Specifies the password to use with the FTP connection. If no password is specified then the password is taken to be empty, the tool will not prompt for a password.
- Gives a status output (on the command line) of the number of files copied, and remaining to be copied. Also lists files as they are copied.
- Consider subdirectories. Without this only the contents of the source folder will be copied and not any sub-directories.
- Delete old files. Without this flag new and modified files will be copied to the FTP server but any files that have been removed in the source folder would not be removed at the server.
- The name of file to log any errors to. Any errors will also appear on the standard-output, but using this allows errors to be captured to a separate log file.
The following script used to be used (on a weekly basis) to download virus definitions from the network associates FTP site:
CryCopy /subs /readonly /newer /Make /V1 /deleteold ^
"C:\Brian\Other Notes" ^
This copies everything except .tmp, .bak and .wbk files from the local folder to a network share. It does not copy sub-directories, because the "/s" flag has not been specified.
- The above is similar to xcopy but with the addition that three file types are excluded from the copy and files which do not exist at the destination will be removed.
- This style of copying can be very fast - because it will only copy files which are newer or which do not exist at the destination. This makes it suitable for use as part of a backup regime, where only a minority of files change from one day to the next. This is considerably faster than doing a complete copy.
To copy a single specific file from one folder to another:
CryCopy "C:\Brian\Other Notes" "C:\Temp" +\file.doc
Normally "+" is used to specify a wildcard expression, such as "+*.doc". In this
case there is no wildcard, so the file will only be copied if it matches against
the full path. The starting directory, in this case "C:\Brian\Other Notes" is
not included when performing the wildcard match, so "\file.doc" means only a
file called "file.doc" in the top most folder considered, which in this case is
To use an FTP port other than the default (control) port of 21, append :port-number to the server address. So for example, to use port 20 instead of the default port 21:
CryCopy "c:\users\brian\web\home page" ftp:\\upload.ntlworld.com:20 /U:username /P:password /V1 /delete /subs /errors:C:\Temp\PubNtlErr.log
Do not specify a port unless you have good reason for doing so, as in most cases this will stop it from working.
- Whilst these examples are copying to an FTP site, it can be used locally to copy from drives or network shares.
- Other than a source and destination, all other parameters are optional.
If you provide a spec of files to copy, e.g. "+*.htm", then ONLY those files that match will be copied. If you don't specify any files to include in the copy then all files will be copied.
- The + and - file specs are matched against
the full path name not just the filename, so "-*\foo\*.tmp" will ignore any tmp
files under "\foo" (or \foo\example\ etc).
To specify to ignore a folder add a trailing backslash, so "-*\foo\" will ignore all directories called "foo".
- You cannot (currently) use a trailing backslash to specify to include
only matching folders.