Recent Posts

Sponsors
![]() |
How to delete files when argument list too longMike Peters, 01-23-2014 |
Ever try to delete a lot of files in a folder, only to have the operation fail with "Argument list too long"?
Here's how to get it done:
FreeBSD
find . -name "*.pdf" -print0 | xargs -0 rm
Note that this is a recursive search and will find (and delete) files in subdirectories as well.
Linux
find . -name "*.pdf" -maxdepth 1 -print0 | xargs -0 rm
Here's how to get it done:
FreeBSD
find . -name "*.pdf" -print0 | xargs -0 rm
Note that this is a recursive search and will find (and delete) files in subdirectories as well.
Linux
find . -name "*.pdf" -maxdepth 1 -print0 | xargs -0 rm
![]() |
Mike Peters, 01-23-2014 |
Here's another useful one -
How to delete all files with size 0 (delete empty files):
find . -size 0 -print0 | xargs -0 rm
How to delete all files with size 0 (delete empty files):
find . -size 0 -print0 | xargs -0 rm
|

Subscribe Now to receive new posts via Email as soon as they come out.
Comments
Post your comments