Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have folders in scenery/terrain that contain folders called terrain and objects. These folders have folders with data files. How do I move all of the contents scenery/terrain/[name]/terrain to scenery/terrain, and the contents of scenery/terrain/[name]/objects to scenery/objects?

share|improve this question

2 Answers 2

up vote 7 down vote accepted

There is no recursive option for the mv command, so if there are directories inside the directories you want to move, you'll have to use cp. How about this one:

cp -R scenery/terrain/*/terrain/* scenery/terrain/
cp -R scenery/terrain/*/objects/* scenery/objects/

Then when you're sure that worked:

rm -rf scenery/terrain/*/terrain
rm -rf scenery/terrain/*/objects
share|improve this answer
    
Good point, but I think under Mac OS it will be cp -R (upper case R). –  QSQ Oct 2 '12 at 21:51
    
@QSQ Thanks for the correction. Fixed it now. –  Ryan Oct 2 '12 at 21:55
    
-r worked fine. –  Andrew D. Oct 2 '12 at 23:17
mv scenery/terrain/*/terrain/* scenery/terrain/
mv scenery/terrain/*/objects/* scenery/objects/
share|improve this answer
    
Thanks, I'll see if that works. –  Andrew D. Oct 2 '12 at 21:13
    
Try it on a copy of the folder in case I misunderstood something :-) –  QSQ Oct 2 '12 at 21:14
    
Too late now.. Fail on my part. I can always just re-torrent the 13 GB of scenery. –  Andrew D. Oct 2 '12 at 21:15
    
Didn't work. Says that "directory is not empty" –  Andrew D. Oct 2 '12 at 21:16
    
Hmm odd. I had tried it here with building a tree like that and putting files into scenery/terrain/a/terrain/ scenery/terrain/b/terrain/ and scenery/terrain/a/objects/ and scenery/terrain/b/objects/ –  QSQ Oct 2 '12 at 21:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.