Deleting only certain files from specified location and its sub-folders [SOLVED]
Posted: 28 Apr 2023 12:25
I want to automatically get rid of e.g. temporary files of Excel which sometimes are left over after its crash. Such file can look like this
S:\Data
and its sub-folders and their sub-folders
I tried using
and
and some variants of them but I was not able to write a working one
Was it because such temporary files have the hidden attribute applied to them?
Lets say they are in a folder like~$OriginalNameOfMyFile.xlsm
S:\Data
and its sub-folders and their sub-folders
I tried using
Code: Select all
forfiles /s /m "~$*.xlsm" /c "cmd /c del @path" /p "S:\Data"
Code: Select all
for /r "S:\Data" %x in (~$*.xlsm) do del "%x"
Was it because such temporary files have the hidden attribute applied to them?