PDA

View Full Version : [all variants] Move all sub folders in a directory up one directory.



saj0577
November 9th, 2008, 12:37 AM
Recently I ripped and converted all my music and like a fool I told it to file in folders like so:

Artist Name/Album/Artist Name/Album


So is there anyway to copy the Artist Name (inside the Album Folder) and move it up 2 directories and delete the duplicated folders.


Hard to explain and understand not understand let me know.

Saj

keplerspeed
November 9th, 2008, 12:47 AM
You could do a recursive move:

navagate to the first Album directory


cd Artist\ Name/Album/

then move the second artist name directory to the music directory:


mv -r Artist\ Name /home/yourname/music/

You can then delele the now empty first album directory:


cd ..
rm Album

saj0577
November 9th, 2008, 02:59 AM
That would mean I have to cd into every directory which would not be time efficient. Anyway to do it to alot of folders at once.

Saj

earthpigg
November 9th, 2008, 03:27 AM
open ~/My Music/Artist Name/Album/ select everything, and drag it to ~/My Music

merge all folders when it asks

or am i missing something?

bodhi.zazen
November 9th, 2008, 04:01 AM
use find

http://content.hccfl.edu/pollock/Unix/FindCmd.htm

find type -d ./ -exec /bin/cp -R '{}' ..;

saj0577
November 9th, 2008, 01:15 PM
open ~/My Music/Artist Name/Album/ select everything, and drag it to ~/My Music

merge all folders when it asks

or am i missing something?


That would work, but I have around 500 folders like this so doing it that way (manually) would take me ages.

Saj