E-Mail:
Author Avatar

How Can I Flatten A Directory Structure In Mac OS X?

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]

What Do You Think?

 


Anti-Spam Image

Want to Start a Blog Here for Free?

Are you an expert in one subject or another? If your goal is to help others and dispense hard-earned information back to the community, stake a claim on your very own Lockergnome blog today! You can write about anything - no matter the topic. Sign-up to start blogging!

Author Avatar
Resource - Jul 7, 2008

75% Off Mac Life Cover Price

Author Avatar
Apple, Feedback - Apr 7, 2008

Mac Development

Author Avatar
Apple, Resource - Apr 3, 2008

Macworld Free Trial