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.

  • Never used FtpUse but what if you setup a Linux Samba Staging Server that both servers accessed? Robocopy to Samba Share and all the Linux server did was provide a network share – Brian Oct 9 '13 at 13:23
  • This is an Windows to Windows setup and it seems like a huge job to setup an extra server for this file transfer task. – user1632306 Oct 9 '13 at 13:39
  • Thoughts... can you test a simple copy using COPY or XCOPY, just to confirm whether it's actually ROBOCOPY at fault, or an issue with the drive presented by FTPUSE.EXE. Second, and it's probably just your example, the error is flagged for a .XLSM file, but this file type isn't in your command. Just wondering whether there's something else going on here... – Simon Catlin Oct 9 '13 at 19:31
  • Thanks for your input @simonc. I tried to use COPY and XCOPY and it gives me an error message much like when using robocopy: "File creation error - the parameter is incorrect". However, I've succesfully copied files from the FTP (Q:) drive to my local drive. So it probably has something todo with permissions. Any ideas? – user1632306 Oct 10 '13 at 10:52
  • 1
    You can read/write from/to the mapped drive via GUI, but you can't do it from the command prompt? What commands are you using in COPY/XCOPY? – CIA Oct 14 '13 at 14:07
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%"
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!

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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