How Can I Flatten A Directory Structure In Mac OS X?
- 0
- Add a Comment
Dave, how can I flatten a directory structure? I’ve got a directory “foo” with many more sub-directories and files within. I want to take all the files from all levels beneath foo and put them in foo itself.
I’ve tried this: find . *.mp3 -print0 | xargs -0 mv . but I get an error on the mv command that I can’t figure out. Help!
You’re definitely on the right path here. To extract all files in a subdirectory, the find command is the correct program, and using the Mac-specific extension “-print0″ coupled with the xargs “-0″ lets you handle those annoying filenames with spaces in them.
There are two problems with what you have here, though: first off…
[Continue reading about Mac OS X, find, xargs and directory structures]
