Python Bulk-Renamer for Date-Modified
-
#There was no python sub-category forum, so posted this here. --------------------- Hey mates, on ubuntu-linux. I need/want to code a python applicaton that does the following: takes the 'date-modified' of the file (almost always a .jpg jpeg) and adds a 8 digit format string to the beginning of it. I have manually using pyrenamer to rename them. When I have many files all on the same date. this works, but but but, when I have many files on different dates this is tedious. the format string would be: EXAMPLE; file modified on 2012-17-Mar change name to 20120317_num where num is just a two digit numbe 01,02,... Any ideas on how I would start to code such an app. It is a relatively simple process but I fear it will be complex to code and outside of my skill-level and will need to research a lot of things like how to get the date-modified information manipulating/changing the string of 2012-17-Mar I could see a lot of if-elses for the 12 months and whatnot. Relatively simple concept; currently outside of my abilities as a coder, but this would be great to code. If anyone has any resources on how to do this, would be rewarding for me to code, would be freakishly useful, and would safe time. thanks! pyrenamer is super bulk-file-renamer (the best i've seen across mac, windows, and linux OSes) but that specific usage where it takes the file format etc is complex. I guess I would rather find such an app (to process files) AND THEN code a separate one for the reward of coding. Recently i've been making folders of month and then subfolders of day and putting corresponding date-modified files in the month/day folder and then using pyrenamer. again, tedious when have many 'different days' of date-modified.
-
#There was no python sub-category forum, so posted this here. --------------------- Hey mates, on ubuntu-linux. I need/want to code a python applicaton that does the following: takes the 'date-modified' of the file (almost always a .jpg jpeg) and adds a 8 digit format string to the beginning of it. I have manually using pyrenamer to rename them. When I have many files all on the same date. this works, but but but, when I have many files on different dates this is tedious. the format string would be: EXAMPLE; file modified on 2012-17-Mar change name to 20120317_num where num is just a two digit numbe 01,02,... Any ideas on how I would start to code such an app. It is a relatively simple process but I fear it will be complex to code and outside of my skill-level and will need to research a lot of things like how to get the date-modified information manipulating/changing the string of 2012-17-Mar I could see a lot of if-elses for the 12 months and whatnot. Relatively simple concept; currently outside of my abilities as a coder, but this would be great to code. If anyone has any resources on how to do this, would be rewarding for me to code, would be freakishly useful, and would safe time. thanks! pyrenamer is super bulk-file-renamer (the best i've seen across mac, windows, and linux OSes) but that specific usage where it takes the file format etc is complex. I guess I would rather find such an app (to process files) AND THEN code a separate one for the reward of coding. Recently i've been making folders of month and then subfolders of day and putting corresponding date-modified files in the month/day folder and then using pyrenamer. again, tedious when have many 'different days' of date-modified.
I did something similar with BASH a while ago, to rename files according to their modification date:
saveIFS="$IFS"; IFS=$'\0'; while read -a line; do mv "${line[1]}" "${line[0]%.*}.${line[1]}"; done < <(find -maxdepth 1 -type f -printf "%T+\0%f\n"); IFS="$saveIFS"
Hope it helps!