0

I have the folder c:\AA\ that everyday there will be a new BAK file. When I run the command it will re-rar every files not just the newest file.

I use this batch code:

FOR %%A IN (C:\AA\*.txt*) DO "C:\Program Files\WinRAR\WinRAR.exe" m "C:\AA\%%~nA.zip" "%%A"

Anyone know how I could zip file only the newest file? Thank you in advance.

Nixphoe
  • 4,584
  • 7
  • 34
  • 52

1 Answers1

0

Perhaps you can use the forfiles command. Something like

FOR %%A IN ('FORFILES /D 0 /P c:\AA /M .txt') DO "C:\Program Files\WinRAR\WinRAR.exe" m "C:\AA\%%~nA.zip" "%%A"
Nixphoe
  • 4,584
  • 7
  • 34
  • 52