Forfiles don't memorize Variable by SET

44 Views Asked by At

I use an .xlsx file that grows progressively for updates. The syntax:

FORFILES /P  C:\TMP /S /M *.XLSX /C "cmd /c echo @path = @fsize"

and everything works fine.

I would like to store the size of @FSIZE in a variable to retrieve the data in a comparison but that doesn't seem to work.

If I use:

FORFILES /P  C:\TMP /S /M *.XLSX /C "cmd /c SET MySize=@fsize"

does not store the value. In fact, if you try to type SET %MySize% from the prompt it tells you that the value is null. Very frustrating.

It would be nice to be able to run:

FORFILES /P  C:\TMP /S /M *.XLSX /C "cmd /c IF %MySize% LSS @fsize DEL @path

I would like to retrieve the value of @fsize for future comparisons. If the .XLSX files are smaller than @fsize, then delete them.

0

There are 0 best solutions below