I have a directory :
../Music with a lot of music files in a lot of subdirectories.
How would i move all the files in the subdirectories to another directory ?
Thus, i only want to move the files, i don't want to keep the subdirectory structure.
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
cd ../Music for i in `ls -Q`; do mv $i/* /Path/To/Some/Other/Directory; done
I would suggest to use
cp instead of
mv to check whether it is working fine or not. and if it is working fine just delete the
-Q (and needed to add this explanation to get beyond six characters)
You could also use Rhythmbox, banshee, or a similar software. They can scan your music directories.
You can choose to preserve the directory or (in your case) the software can move the files in to a rhythmbox/banshee directory which would eliminate the hierarchy like you wanted.
cp /target/directory/* /desination/directory/ -r
Then, delete the original if it was successful.