Windows command line ftp put / upload files older than 1 minute

I have the following batch file:

open <ip>
username
password
bin
lcd C:\FTP_OUT\
prompt
mput *.PDF
ascii
mput *.XML
bye

How can I change it to upload only files older than 1 minute to an FTP server?

+3
source share
1 answer

Windows ftp.exedoes not support any file selection based on the timestamp of the file.

All you can do is create a temporary download script with an explicit list of files to download. You can use a PowerShell script to generate a temporary script (implementation in a pure batch file will be very complicated).


Another solution is to use an FTP client that supports file selection based on the file’s timestamp.

, FTP/SFTP WinSCP :

@echo off
winscp.com /log=upload.log /command ^
  "open ftp://username:password@example.com/" ^
  "lcd C:\FTP_OUT" ^
  "put *.PDF<1N" ^
  "put -transfer=ascii *.XML<1N" ^
  "exit"

<1N , , .

. Windows ftp.exe WinSCP.

( WinSCP)

0

All Articles