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

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
kaungsat
Posts: 1
Joined: 23 Aug 2021 01:52

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

#1 Post by kaungsat » 23 Aug 2021 02:04

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?

kwsiebert
Posts: 40
Joined: 20 Jan 2016 15:46

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

#2 Post by kwsiebert » 23 Aug 2021 09:11

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.

aGerman
Expert
Posts: 4245
Joined: 22 Jan 2010 18:01
Location: Germany

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

#3 Post by aGerman » 23 Aug 2021 10:04

Another possibility is to download only files that don't exist in the local target.
https://www.dostips.com/DtTipsFtpBatchS ... lyNewFiles

Steffen

Post Reply