SEARCH

How-To Geek

Upload Files to an FTP Site With a Right-Click Using this Simple Script

image

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.

Connection Information

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%

Limitations

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.

 

Download SendToFTP script from How-To Geek

Jason Faulkner is a developer and IT professional who never has a hot cup of coffee far away. Interact with him on Google+

  • Published 09/29/11

Comments (5)

  1. madis

    Seemed really awesome till the part where you can’t send directories, only files :)
    Tnx anyway.

  2. RDSchaefer

    Not bad at all. Two suggestions and a question though:

    1) Rename the script to *.CMD instead of .BAT

    2) Change the commands filename to CmdsFile from Commands so it’s more obvious to less experienced users.

    Q) Not everyone has the Resource Kit so they’ll be confused when the script fails on the TIMEOUT command. Can you suggest an alternative? I would recommend the freeware program SLEEP (http://www.freewarefiles.com/Sleep_program_59294.html) or it would be trivial to write one.

  3. Jason Faulkner

    @RDSchaefer – to address your questions/comments:

    1 – I’m not really sure what this would accomplish. There is no real difference between running the file as a BAT or CMD file… both use the cmd.exe as their processing engine.

    2 – It would have to be understood if you are editing variables in the script, you would know what you are doing. For people that just want to use the standard functionality, the variable name shouldn’t matter.

    Q – TIMEOUT is a default command in Vista/7/2008. You cause use PAUSE instead (which is a native command in XP/2003), which would force you press a key in order to close the script. Alternately, you could just remove this line if you don’t care to review the results.

  4. Kamil

    My favorite utility for this exact functionality so far is “RightLoad” (http://rightload.org/). Multiple destinations and the ability to automatically copy addresses for direct/forum/thumbnail links saves me an amazing amount of time every day.

  5. Ashok

    i am unsure if this would accomplish , i am certainly in a daze , ok anyways i have to review it , thanks for this article !

Get Free Articles in Your Inbox!

Join 134,000 newsletter readers

Email:

Go check your email!