Register
It is currently Thu Jul 24, 2014 3:39 pm

Recursively move a subfolder to one upper level


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Tue Jul 19, 2011 6:57 pm   

Joined: Mon Jul 04, 2011 9:29 pm
Posts: 3
Location: Richmond, Canada
Hi, all:

My folder structure is like:

Quote:
root
----branch1
--------ae
------------kkk
----branch2
--------ae
------------kkk
...
----branch100
--------ae
------------kkk


What I'm expecting to realize is to have my folders look like:

Quote:
root
----branch1
------------kkk
----branch2
------------kkk
...
----branch100
------------kkk


How to realize it?

Cheers
Pei


Top
 Profile WWW  
 PostPosted: Tue Jul 19, 2011 10:54 pm   
User avatar

Joined: Wed Jun 08, 2011 8:27 am
Posts: 189
Location: outer Shpongolia
Code:
for d in root/*/*; do mv "$d"/* "${d%/*}"/; rmdir "$d"; done


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP