Spaces in the file name

Maybe you’ve found white spaces in your filenames and run into problems trying to delete them.

This little trick make the job. We first find all files containing whitespaces and then pass them to xargs so we can build the command to delete the file(s).

find . -type f -mtime +30 -print0 | xargs –null rm

or…

find . -type f -mtime +30 -print0 | xargs -0 rm

Note: Be very careful whith rm as you can delete files you do not want to.

Leave a Reply

You must be logged in to post a comment.