Photos lost file date on copy from USB

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
UserError
Level 1
Level 1
Posts: 42
Joined: Thu Aug 14, 2014 8:06 am
Location: UK
Contact:

Photos lost file date on copy from USB

Post by UserError » Thu Apr 28, 2016 10:26 am

LM 17 Raphaela
I found an old SD card which had a load of photos my kids had taken, dating back to 2010. I copied them from the card (via USB adaptor) to my PC. Too late, as I hit delete on the card, the copied versions all had todays date. This now makes an enormous task of sorting through shedloads of photos to put them in the right date directories as I have a YY/MM system set up.

I tried running Recuva on a Windows PC but that didn't do too well.

I have been told (on here or SE) that Linux doesn't see a need to keep record of the file creation date - this seems bonkers to me. Why would you NOT want to ever know the creation date?

Is there any software that will read the exif data & append that to the file name? Or some other option
Thanks

User avatar
Flemur
Level 17
Level 17
Posts: 7082
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: Photos lost file date on copy from USB

Post by Flemur » Thu Apr 28, 2016 11:13 am

Check out "exiftool"
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
Mint 19.1 Xfce/fluxbox
Manjaro openbox/fluxbox

User avatar
WharfRat
Level 21
Level 21
Posts: 13080
Joined: Thu Apr 07, 2011 8:15 pm

Re: Photos lost file date on copy from USB

Post by WharfRat » Thu Apr 28, 2016 1:15 pm

UserError wrote: Is there any software that will read the exif data & append that to the file name? Or some other option
Thanks
For future reference if you use cp -a it will preserve everything and cp- p will preserve the ownership and time stamp of files.

After installing exiftool, copy all the image files to a temporary folder then change to it and give this a try

Code: Select all

for f in *;do d=$(exiftool -DateTimeOriginal $f|awk '{print $4}'|tr ":" '-');t=$(exiftool -DateTimeOriginal $f|awk '{print $5}'); touch $f -d "$d $t" ;done 
Good luck :wink:
ImageImage

UserError
Level 1
Level 1
Posts: 42
Joined: Thu Aug 14, 2014 8:06 am
Location: UK
Contact:

Re: Photos lost file date on copy from USB

Post by UserError » Mon May 09, 2016 4:08 pm

Thanks, will try that when I get a mo.

UserError
Level 1
Level 1
Posts: 42
Joined: Thu Aug 14, 2014 8:06 am
Location: UK
Contact:

Re: Photos lost file date on copy from USB

Post by UserError » Mon May 16, 2016 7:11 am

For future reference if you use cp -a it will preserve everything and cp- p will preserve the ownership and time stamp of files.
Hi,
Just tried cp -p & got this
cp: preserving times for ‘/media/NAS/~/P1050292.JPG’: Operation not permitted

Presumably because it's a NAS or the way it's mounted?
I tried copying to a local folder & that was OK, then tried copying from local to NAS & still "not permitted".

Any ideas please?
Many thanks

UserError
Level 1
Level 1
Posts: 42
Joined: Thu Aug 14, 2014 8:06 am
Location: UK
Contact:

Re: Photos lost file date on copy from USB

Post by UserError » Mon May 16, 2016 7:16 am

SUDO cracked it!
Many thanks.
Still to investigate Exiftool manana

Mute Ant
Level 14
Level 14
Posts: 5135
Joined: Tue Sep 03, 2013 7:45 pm
Location: Norfolk UK

Re: Photos lost file date on copy from USB

Post by Mute Ant » Mon May 16, 2016 8:48 am

If you are dealing with JPEG pictures and the time stamp is already lost, there's a less-invasive command-tool in the jhead package that will re-stamp the file system time to match the EXIF data...

Code: Select all

### Set all the visible JPEG file time stamps to match what is stored in the Exif header...
    jhead -ft *.jpg
The jhead command can also rename files to match the EXIF time stamp...

Code: Select all

### Rename all the visible JPEG files to match what is stored in the EXIF header...
    jhead -n%Y%m%d-%H%M%S *.jpg
Last edited by Mute Ant on Sat May 21, 2016 4:31 pm, edited 1 time in total.
While you're waiting, read the free novel we sent you. It's a Spanish story about a guy named "manual".

User avatar
phd21
Level 19
Level 19
Posts: 9178
Joined: Thu Jan 09, 2014 9:42 pm
Location: Florida

Re: Photos lost file date on copy from USB

Post by phd21 » Mon May 16, 2016 10:48 am

Hi "UserError",

I just read your post and the good replies to it. Here are my thoughts on this as well.

1.) There is an excellent program called "XnViewMP" which can view and sort by various options which you might want to install and look at. There are many others too, like Gwenview, DigiKam, etc...

XnViewMP - just download the easy to install Linux 32-bit or 64-bit ".deb" file, and double click it to install it, if it does not start installing right away by itself.
http://www.xnview.com/en/xnviewmp/

2.) There are also numerous file recovery options in Linux and MS Windows. In Linux, search the Software Manager or Synaptic Package Manager (SPM) for "recover", "undelete", etc... A lot depends on the file system of the "SD" card.

3.) As was already mentioned, there are ways to copy and or move the files from one place to another without the date changing. I just copied a folder to another folder using my file manager, and all the dates stayed the same. I just copied files from one folder to another using the file manager and the dates did not change. How did you copy the files and or folders?


Hope this helps ...
Phd21: Mint KDE 18.3 & 19, 64-bit Awesome OS, Ancient Dell OptiPlex 780 Core2Duo E8400 3GHz,4gb Ram,256gb SDD, Video: Intel 4 Graphics, DVD Lightscribe. Why I use KDE?:https://opensource.com/life/15/4/9-reasons-to-use-kde

Post Reply

Return to “Newbie Questions”