Page 1 of 1

How to download only today files from ftp using batch script?

Posted: 23 Aug 2021 02:04
by kaungsat
ftp
open host
username
password
binary
prompt
cd /home/
lcd c:\
mget *txt
disconnect
bye

i want to download only today files from ftp.can you pls tell me what should i change?

Re: How to download only today files from ftp using batch script?

Posted: 23 Aug 2021 09:11
by kwsiebert
If the files have a date stamp in their name, you can have your batch file determine the date and use it as part of your mget line. If they don't, you'll have to connect once and output the results of a dir command to a text file, and then parse the dates from that file to create a list of files and add them individually to a script file that is passed to the ftp program.

Re: How to download only today files from ftp using batch script?

Posted: 23 Aug 2021 10:04
by aGerman
Another possibility is to download only files that don't exist in the local target.
https://www.dostips.com/DtTipsFtpBatchS ... lyNewFiles

Steffen