Originally posted by Pondlife
View Post
- Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
- Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
Reply to: Script to update 'created on' timestamp
Collapse
You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:
- You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
- You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
- If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.
Logging in...
Previously on "Script to update 'created on' timestamp"
Collapse
-
I'll have a crack at weekend too - Unix flavours despite being fairly consistent often isn't on stuff like this, once spent ages cursing RHEL cos it didn't have 'grep -p' like in AIX. Plus I just bagged a HP-UX box I wanna play with!
-
Originally posted by TheFaQQer View PostI found that, but couldn't get it to work on my Linux box (which is very out of date now), so didn't post it.
The next step for you to consider is to go through the renamed files and take the new modified date and use that to correct the EXIF data in the image file
http://www.sentex.net/~mwandel/jhead/usage.html
Will have a look at the weekend hopefully
Leave a comment:
-
I found that, but couldn't get it to work on my Linux box (which is very out of date now), so didn't post it.
The next step for you to consider is to go through the renamed files and take the new modified date and use that to correct the EXIF data in the image file
Leave a comment:
-
In case anyone else is ever looking for something similar, I've pinched this off askubuntu and it works fine on my MBP. Just add in the number of days you want to shift the timestamp by (73days in the case below).
Note: this only updates the 'modified on' if it's later than 'created on' but I'll fiddle when I get the chance.
Ta all.
#!/bin/bash
# find specific files
files=$(find . -type f -name '*.jpg')
# use newline as file separator (handle spaces in filenames)
IFS=$'\n'
for f in ${files}
do
# read file modification date using stat as seconds
# adjust date using date and print in correct format
# change file time using touch
touch -t $(date -v +73d -r $(stat -f %m "${f}") +%Y%m%d%H%M.%S) "${f}"
done
Leave a comment:
-
Originally posted by stek View PostIf a Unix system (or Unix-like) 'touch -t timestamp_you_want filename(s) - wildcards/regex works in the filename bit.
eg: touch -t 201409161030 pic*.jpg
for a timestamp of 16th of Sept 2014 at 10:30am......
EDIT: reread - this won't do exactly what you want, you'd need to do some awk/sed/grep'ing on a listing to squirt into a for loop.
Cheers Stek.
Leave a comment:
-
If a Unix system (or Unix-like) 'touch -t timestamp_you_want filename(s) - wildcards/regex works in the filename bit.Originally posted by Pondlife View PostMaybe a long shot but thought I'd ask.
Background: Every year when we go on hols I forget to update the current date/time on the camera, which means that all the image files have a created on of 01 Jan 2010 + the holiday duration.
I'd like a script/prog/app that I can run in a directory that will update the created on timestamp relative to a specified value. i.e it replaces 01/01/2010 + holiday elapsed time with 16/09/2014 + HET
Any ideas?
TIA
Pondy.
eg: touch -t 201409161030 pic*.jpg
for a timestamp of 16th of Sept 2014 at 10:30am......
EDIT: reread - this won't do exactly what you want, you'd need to do some awk/sed/grep'ing on a listing to squirt into a for loop.Last edited by stek; 16 September 2014, 10:56.
Leave a comment:
-
Mac, Win or Ubuntu.Originally posted by eek View PostWhat operating system?
Cheers Faq. Will take look.Originally posted by TheFaQQer View PostDon't know whether this still works, but it looks like it might do the trick - BulkFileChanger: Change date/time/attributes of multiple files
Leave a comment:
-
Don't know whether this still works, but it looks like it might do the trick - BulkFileChanger: Change date/time/attributes of multiple files
Leave a comment:
-
What operating system?Originally posted by Pondlife View PostMaybe a long shot but thought I'd ask.
Background: Every year when we go on hols I forget to update the current date/time on the camera, which means that all the image files have a created on of 01 Jan 2010 + the holiday duration.
I'd like a script/prog/app that I can run in a directory that will update the created on timestamp relative to a specified value. i.e it replaces 01/01/2010 + holiday elapsed time with 16/09/2014 + HET
Any ideas?
TIA
Pondy.
Leave a comment:
-
Script to update 'created on' timestamp
Maybe a long shot but thought I'd ask.
Background: Every year when we go on hols I forget to update the current date/time on the camera, which means that all the image files have a created on of 01 Jan 2010 + the holiday duration.
I'd like a script/prog/app that I can run in a directory that will update the created on timestamp relative to a specified value. i.e it replaces 01/01/2010 + holiday elapsed time with 16/09/2014 + HET
Any ideas?
TIA
Pondy.Tags: None
- Home
- News & Features
- First Timers
- IR35 / S660 / BN66
- Employee Benefit Trusts
- Agency Workers Regulations
- MSC Legislation
- Limited Companies
- Dividends
- Umbrella Company
- VAT / Flat Rate VAT
- Job News & Guides
- Money News & Guides
- Guide to Contracts
- Successful Contracting
- Contracting Overseas
- Contractor Calculators
- MVL
- Contractor Expenses
Advertisers

Leave a comment: