rename - Command to add specific time on a filename? - Ask Ubuntu


i returned trip , try organize minimum photos taken wife , me 4 devices : our 2 smartphones , 2 cameras.

i choose rename files pyrenamer (exif) : yyyymmdd_hhmmss.jpg

both smartphones , 1 camera @ local time, no problem. wife's camera had time shift of 5:46.

my question simple : how add 5:46 each file ?

thanks lot in advance.

note: following not change either exif data or actual timestamp of files - names. may preferable change 3 consistently (perhaps possible using exiftool?)


it seems possible using perl based prename / rename command, using strptime read in formatted time string, strftime write out after adding offset - in seconds (implicitly converted time::piece object).

based on comments, "my wife's camera had time shift of 5:46" appear mean 5 hours 46 minutes (rather than, say, 5 minutes 46 seconds), , require shift (forward) of 5 x 3600 + 46 x 60 = 20760 seconds. do:

prename -vn -- ' begin{use time::piece}; s/\d+_\d+/(20760+time::piece->strptime($&, "%y%m%d_%h%m%s"))->strftime("%y%m%d_%h%m%s")/e ' *.jpg 20161019_112301.jpg renamed 20161019_170901.jpg 

the -n flag testing - remove when sure command performing right conversion.

see related question how can batch convert folder names 1 date format another


Comments

Popular posts from this blog

download - Firefox cannot save files (most of the time), how to solve? - Super User

windows - "-2146893807 NTE_NOT_FOUND" when repair certificate store - Super User

sql server - "Configuration file does not exist", Event ID 274 - Super User