Execute commands on folder and files containing spaces


On Linux or Unix systems perform recursively a command on items might contain white space, quote marks, or backslashes can be a problem when using find | xargs combination.

To solve this you may use:

find -type d -print0 | xargs -0 <command>
find -type f -print0 | xargs -0 <command>

For example to fix recursively permission:

find -type d -print0 | xargs -0 chmod 755
find -type f -print0 | xargs -0 chmod 644

Information and Links

Join the fray by commenting, tracking what others have to say, or linking to it from your blog.


Other Posts
Net_Nmap 1.0.0 beta1 released!
Ortro 1.3.0 is out!

Write a Comment

Take a moment to comment and tell us what you think. Some basic HTML is allowed for formatting.

Reader Comments

[...] public links >> xargs Execute commands on folder and files containing spaces Saved by speechpoet on Wed 29-10-2008 Useful find Commands Saved by lluisbw on Sat 25-10-2008 [...]