I\'ve a directory with many number of 0 byte files in it. I can\'t even see the files when I use the ls command. I\'m using a small script to delete these files but sometime
With GNU's find
(see comments), there is no need to use xargs :
find -name 'file*' -size 0 -delete
If you want to find and remove all 0-byte files in a folder:
find /path/to/folder -size 0 -delete
Use find
combined with xargs
.
find . -name 'file*' -size 0 -print0 | xargs -0 rm
You avoid to start rm
for every file.
find . -maxdepth 1 -type f -size 0 -delete
This finds the files with size 0 in the current directory, without going into sub-directories, and deletes them.
To list the files without removing them:
find . -maxdepth 1 -type f -size 0