Unix/Linux — find & xargs — Spaces in filenames

By Radu Cornea

Spaces in filenames can be a problem when using find | xargs combination.

To solve this, use:

find . -print0 | xargs -0 <command>

This tells find and xargs to use the ASCII NUL character instead of space to end (separate) the filenames.

2 Responses to “Unix/Linux — find & xargs — Spaces in filenames”

  1. ivanatora Says:

    Nice tip :)
    Nice blog, too.
    I’d recommend to split the C/C++ categories, becouse lots of your snipplets are valid in only one of the two languages.

  2. toledo’s code blog » Blog Archive » Using find and xargs on directories with spaces Says:

    [...] to Not So Frequently Asked Questions, where I found the solution [...]

Leave a Reply

You must be logged in to post a comment.