1.

Solve : FTP'ing?

Answer»

Hello all,

Am trying to work out how to save file(s) to a certain folder on my PC when obtaining them via FTP.

At the same time I'd like to rename them based on the date.

I need to make the process automatic, so the commands will be run from a text file.

Any help much appreciated!
To change the directory on your pc, use LCD (Local Change Directory)
To rename a file, do
get
so if you want to use todays date, you will have to create your SCRIPT on the fly, then call it

GrahamOr download the file always into the temp directory as gpl describes and then move afterwards.
I.e. LETS say you down LOADED file is named "server.log" that was downloaded to "C:\temp" and your final ARCHIVE folder is "c:\archive" then the following should work


Code: [Select]ftp -i -s:"FtpScriptName.txt"

set UNIQUE=%date:~10%%date:~4,2%%date:~7,2%
move /y "C:\temp\server.log" "C:\temp\server_%UNIQUE%.log"
Tips to embed a FTP script into a cmd batch file here:
http://dostips.cmdtips.com/DtCodeBatchFiles.php

Hope this helps That's really helpful, thanks!!



Discussion

No Comment Found