While there are a myriad of FTP clients available, nothing is easier than sending files to an FTP server with a right-click. Likewise, there are loads of utilities available which add this functionality to Windows, but for a geek it is quite satisfying to uninstall “yet another utility” and replace it with your own tool.
If you find yourself uploading files to an FTP site frequently, we have a script which makes this as easy as a right-click with no external utilities needed.
Customizing the Script
The batch script is ready to use, all you have to do is fill in the blanks and then add a shortcut to your Windows Send To menu. There are comments in the script to help with the setup, but we will cover them here in a bit more detail.
There are 3 variables you will need to set in the script under the Connection Information section:
- Server – The destination FTP site address (i.e. ftp.mysite.com).
- UserName – The user name to connect with.
- Password – For this variable you can hardcode the password by entering the value after the “SET Password=” or, for security reasons, have the script prompt you for the password whenever you run it. To be prompted, comment out the hardcode line by changing it to “REM SET Password=” and then uncomment the line immediately below it (remove the REM) so it reads “SET /P Password=Enter [...]“.
Subdirectories on the FTP Site
In the event you want the files to be uploaded to a subdirectory on the target FTP site, you simply need to edit the change directory, “cd”, line commands. You can find these lines which start with “REM ECHO cd” and then simply list the order you want to navigate through subfolders. By uncommenting these lines (removing the REM) and entering the appropriate subdirectory name after the “cd” you can traverse to your target folder. Of course, you can add more lines as needed.
For example, if you would like to send your files to the directory on your FTP site, “/Dir1/Files/Draft”, the lines in your script would look like this:
ECHO cd Dir1 >> %Commands%
ECHO cd Files >> %Commands%
ECHO cd Draft >> %Commands%
Generally, this script will probably fit most of your basic FTP uploading needs but there are a few limitations to be aware of:
- Files will be overwritten on the FTP server without warning. Keep this in mind in the event you are uploading a file which has the same name as an existing file in the target location.
- You can only send files, not directories. If you select a directory and try to send it to the script, it will not work correctly.
- FTP server, user name, (optionally) password and subdirectory specifications are hardcoded into the script. If you have the need to send files to multiple FTP sites and/or subdirectories, you will need a separate copy of the script (as well as another Send To shortcut) with these values set appropriately.