Hi,
Through the last years I have different types of software to organize my photo and music collections. This has resulted in differences in directory structure, and I'd like this to be uniform.
Problem a: Music collection
I want my music collection to look like: /Artist/Album/files.*
but now there are several instances of /A/Artist/Album/files.*
I'm trying to write a script which:
1. Find all folders with 1 character,
2. Move contents of each one-character folder, to /Artist/
(Flatten structure, and handle spaces in filenames)
find ./Artists/ -name "?" -maxdepth 1 -mindepth 1 | mv * ./Artists/
Gets me halfway, but it doesn't handle spaces in directory names, and I'm a bit unsure if it has other pitfalls.
Problem b: Photo collection
I have a very similar situation here, most of my collection looks like I want it.
Desired:
/Photos/2009/2009-08-07 description/filename.jpg
Current situation:
/Photos/2009/03/21/filename.jpg
I need a script which:
1. Find all folders which match /yyyy/mm/dd/
2. Move content to /yyyy-mm-dd/
3. Delete old folders
Background
I believe a bash script would be well suited, but I am also up and ready for something in python.
I'm using Ubuntu 9.04.
Thank you in advance.