I need to change my directory structure for my photos from /YEAR/MONTH/DAY/ to /YEAR-MONTH-DAY
I know this can sort of be done with exiftool
, but it will only work on files containing EXIF-tags, and I have xmp-sidecar files corresponding to each image, and these need come along too. So I recon script of some kind would be the best way.
I sat down and tried to learn RegEx, sed
, bash and what not, and given enough time, I guess I should be able to figure this one out, but right now I am in a hurry, so any help would be appreciated.
//Ola
Best Answer
The
rename
utility in Ubuntu can rename directory structures but it won't clean up after itself.Stick
-vn
on the end if you just want it to tell you what it's going to do before it renames anything, but here's a little test harness that shows you what's possible:Simply put it's being fed the third-level directories and renaming is reading the earlier two segments and renaming it, sticking it in the current directory. As you can see there will be a load of year directories. Assuming they're empty you could clean up with something like (and I pray you check they're empty first):
I'm using the -i option to force it to ask you before deleting every file. Remove that at your own risk.