2

How to copy files from one directory to another, whose names contain current date, and so the names change daily.

Example:

File name: Test_14042021.txt
Date today: 14/04/2021 // DDMMYYYY

I tried this, but it didn't work:

copy Test_%date:~12,10%%date:~4,2%%date:~7,2%.txt D:\
ZygD
  • 2,459
  • 12
  • 26
  • 43
Raghunath Kurup
  • 23
  • 1
  • 1
  • 3

1 Answers1

1

Try copy Test_%date:~8,2%%date:~5,2%%date:~0,4%.txt D:\

You can use echo Test_%date:~8,2%%date:~5,2%%date:~0,4%.txt to see what exactly you pass to copy. Fine-tune it until you see your actual file name.

ZygD
  • 2,459
  • 12
  • 26
  • 43