Combining RoboCopy with FtpUse

7

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.

windows
ftp
robocopy
asked on Server Fault Oct 9, 2013 by user1632306 • edited Oct 9, 2013 by Dave M

3 Answers

3

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%"
answered on Server Fault Apr 21, 2015 by anuff • edited Apr 27, 2018 by Andrew Schulman
0

When the copy executes you have permission to create files but not to overwrite them. How big are the files? From what I gather every time a file is edited the file is copied again in its entirety and you overwrite the old file with the new version. There is no way to evaluate what has changed in the file and just append the new data? Since you are not trying to append data and the tools you are using do not allow you to overwrite the file you could in theory write some type of intermediary script that deletes outdated files when they are detected immediately prior to copying the new file in place. That sounds like a clunky solution but then the whole thing also sounds like a clunky process. Personally I would re-evaluate what the goal is here and such but I am trying to stick to just answering the question. Good luck!

answered on Server Fault Dec 20, 2013 by mpmackenna
0

Since you already using windows why not use power shell to do this? You can specify only new files and schedule the task with windows task scheduler all with built in windows tools. No need to pay for built in functionality. I assume it is not a secure FTP connection that your using. Some quick scripting will get you a very flexible cheap solution. I have several power shell scripts that pull and push FTP files base on specific criteria.

answered on Server Fault Mar 23, 2015 by pehaada • edited Mar 4, 2018 by (unknown user)

User contributions licensed under CC BY-SA 3.0