Combining RoboCopy with FtpUse

Our clients need to transfer specified files from their network to ours through FTP. The transfer must be invoked automatically whenever one of the specified files changes. For this purpose, RoboCopy is perfect. However, RoboCopy does not support transfer to FTP addresses. So, I would like to map our FTP site to a drive letter on the client server. I found that FtpUse is perfect for mapping an FTP to a drive letter. The mapping works as expected and I can see the contents of the FTP site in Windows Explorer - I can also write data to the mapped FTP drive.

So, let's say I've mapped the FTP site to drive Q on my local machine with this command:

ftpuse Q: [ftp address] [password] /USER:[username]

And try to setup RoboCopy with this command:

robocopy [source dir] Q:\ *.xls *.xlsx /COPY:DAT /LOG+:"[LogDir]\FtpCopyLog.txt" /V /NP /MON:1 /MOT:1 /R:10 /W:30 

When RoboCopy runs, it fails with the following error message:

ERROR 87 (0x00000057) Copying File [source dir]\test2.xlsm The parameter is incorrect

I have tried to map the drive and run the RoboCopy command under the samme user account, but it does not seem to solve the problem.

Hope someone can help.

Any help would be greatly appreciated.


Try using WinSCP in mirror mode. WinSCP can be downloaded from here:

http://winscp.net/eng/download.php

Using WinSCP you won't need to map a drive, it just connects to FTP directly and does the work for you.

Here's a small BAT script that makes this similar to ROBOCOPY.

WATCH OUT: I've added -delete option that removes remote files which no longer match local folder. Double quotes are needed because there are spaces in local path.

set FTPSERVER=v2008  
set FTPUSER=username  
set FTPPASS=password  
set FTPLOCALE=C:\Users\User\Desktop\Local folder  
set FTPREMOTO=/public  
winscp.com /command "open ftp://%FTPUSER%:%FTPPASS%@%FTPSERVER%/" ^
  "synchronize remote -delete ""%FTPLOCALE%"" %FTPREMOTO%"