2 years ago

#36685

test-img

Msj321

How to update the month automatically for a directory within a batch script

I need to be able to update the month via windows in my batch script so that the target directory is always the current month (In numerical format, e.g 01). This saves me having to manually update it every month. This is the solution I have come up with:

option confirm off
set month=%date:~3,2%
open ftp://ftp@IP/2022/%month%
synchronize local -preservetime \\localserver\battest\2022\%month%
close
exit

I am new to batch scripts so I am not sure if the month variable will work for directories or if there are any other issues with this script that I am not noticing. Any help is greatly appreciated.

windows

batch-file

cmd

ftp

winscp

0 Answers

Your Answer

Accepted video resources