Computer Hope
Microsoft => Microsoft DOS => Topic started by: wwise on November 07, 2008, 10:01:28 AM
-
Hi everyone - I'm new to batch files and need some help copying files from a folder that has a password associated with it.
I am trying to copy all files from an FTP://SFTP.URL.COM to a \\dir\project\folder
I have tried cd to the ftp site but that doesn't work. Any ideas? Can I pass a user name and password with it? will xcopy work once I get in?
Any help is appreciated!
-
In addition to your batch file, it might be easier to setup a FTP script. FTP is a shell program with it's own instruction set.
Can I pass a user name and password with it? will xcopy work once I get in?
Name and password, Yes. XCOPY, No.
This link (http://www.robvanderwoude.com/ftp.html) may help you out.
Good luck. 8)
-
Wow! That is very helpful! So now I have a script that launches the FTP script to get all the files in the directory and then deletes everything. But...what if a user posts a new file while I am getting the others? Is there a way to delete the FTP files only if they have a timestamp before I started the get?
-
But...what if a user posts a new file while I am getting the others? Is there a way to delete the FTP files only if they have a timestamp before I started the get?
You might need a smarter FTP client than the one Windows provides. ;D
Do all the files have the same extension? If so you may be able to change the extension of all the available files, use mget *.ext to download all the files with the new extention, then use mdelete *.ext to delete the files. Any file not named with the new extension would not get processed until the next cycle.
You might also get a dir list from the remote computer, then download and delete each file by name.
Good luck. 8)