I have some process which creates some files of 0KB size in a directory and its sub-directories.
How can I delete the files from the file system using the windows command prompt?
Any single command or a script that will do the task will work.
I can only run simple cmd commands and scripts, working on a remote machine with restricted access.
Iterate recursively over the files:
Find out zero-length files:
Delete them:
Putting it all together:
If you need this in a batch file, then you need to double the
%:Note: I was assuming that you meant files of exactly 0 Bytes in length. If with 0 KB you mean anything less than 1000 bytes, then above
ifneeds to readif %~zF LSS 1000or whatever your threshold is.