Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm looking for an ftp software which can upload from windows explorer.

"Cute ftp" has an option like this. You can upload directly from the "context menu", but it seems to only upload to the root folder. I need the software to upload to the correct folder using some sort of mapping.

share|improve this question
    
I mean, if I am in folder "c:\httpdocs" on my windows, and that is mapped to "/httpdocs" on my ftp host, then when I switch to "c:\httpdocs\images" I should be able to upload to "/httpdocs/images". Filezilla and cute ftp allow this within the software itself, but I would like to accomplish this at the windows explorer level. –  Haluk Jan 1 '13 at 22:04
    
You mean synchronized browsing. Please see my edited answer –  nixda Jul 26 '13 at 23:30

1 Answer 1

up vote 0 down vote accepted

Upload files to FTP server using Windows build-in FTP client

You can FTP upload files with Windows onboard utilities only. Just create a CMD script with the code below and place a shortcut in your sendto folder (Win+R→ shell:sendto) for quick context menu access

The "mapped folder" feature request will work too. Filezilla users know this ability as synchronized browsing.

enter image description here

@echo off  
set inputfolder="%~dp1"  
set mappedfolder=%inputfolder:C:\MAPPEDFOLDER1\MAPPEDFOLDER2\=%  
set mappedfolder=%mappedfolder:"=%  
set ftp=%temp%\script.ftp  
>> %ftp% ECHO open 123.4.567.89  
>> %ftp% ECHO user FTPUSER FTPPASSWORD  
>> %ftp% ECHO cd "%mappedfolder%"  
>> %ftp% ECHO binary  
>> %ftp% ECHO send %1  
>> %ftp% ECHO disconnect  
>> %ftp% ECHO quit  
ftp.exe -n -i -s:%ftp%  
del %ftp%  
pause  
exit  

Enter your FTP credentials

  • Replace FTPUSER, FTPPASSWORD and the IP address with your own FTP login data
  • Change C:\MAPPEDFOLDER1\MAPPEDFOLDER2\ to the mapped folder on your local PC

Note: If you upload a file from outside of your mapped folder, the file will be saved into your FTP root folder by default.

How does the script work (Example file C:\some\folder\input.txt)

  1. Only the path from your selected file is saved as inputfolder: C:\some\folder\
  2. The third line compares the input path and your hard coded mapped path (eg. C:\some\). As a result you get folder\ as mapped folder. Later the script tries to open this folder on your FTP root directory
  3. Line 5-12 creates a temporary text file (script.ftp) through multiple echo commands. All your FTP commands are written into this textfile.
  4. The Windows build-in FTP client is called with ftp.exe -n -i -s:%ftp% and gets the FTP command file as parameter. So it knows what to do:
    • First, the FTP program opens a connection to your server together with your login credentials
    • cd "%mappedfolder%" is used to synchronize your input path and the FTP path structure. Fortunately, it can open multiple folders with one call.
    • binary is just a default setting for the file transfer method
    • send %1 finally sends our file. The batch argument %1 represents the input full filename
    • After the transfer finishes, we disconnect from the FTP server and close the FTP client
  5. The last 3 lines are just for cleaning up our traces like deleting the FTP command file and pause will give you the chance to see the script output if all went fine.

Used ressources

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.