I would like to delete all files that are less than a specific size in a directory. Does anyone know if there is a Windows command that will do this? something like del *.* where size<3kb
I am currently doing this:
for /F %%A in ("*.pdf") do If %%~zA LSS 20103409 del %%~fA
and the ouput I get is:
C:Documents and SettingsagordonDesktopest>If 6440450 LSS 20103409 del C:Do
cuments and SettingsagordonDesktopestUS Tox 01-06-11.pdf
The system cannot find the path specified.
...even though that PDF file is small enough to be deleted.
What am I doing wrong?
This is actually working:
FOR %%F IN (*.pdf) DO (
IF %%~zF LSS 20103409 DEL %%F
)
However it is not recognizing the file names because they have spaces! How do I convert the Windows name to a "DOS" name in that script? For example, the Windows name is file name.pdf
I would probably need to convert to "DOS" and it would look like this file_name.pdf
or something like that.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…