Finding Files Across Symbolic Links

Problem

You issued a find command to find your .mp3 files but it didn’t find all of them—it missed all those that were part of your filesystem but were mounted via a symbolic link. Is find unable to cross that kind of boundary?

Solution

Use the -follow predicate. The example we used before becomes:

$ find . -follow -name '*.mp3' -print0 | xargs -i -0 mv '{}' ~/songs

Discussion

Sometimes you don’t want find to cross over onto other filesystems, which is where symbolic links originated. So the default for find is not to follow a symbolic link. If you do want it to do so, then use the -follow option as the first option in the list on your find command.

See Also

  • man find

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.103.202