How to change file date to creation date ?

Questions about other topics - please check if your question fits better in another category before posting here
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
ec91066
Level 1
Level 1
Posts: 35
Joined: Wed Mar 26, 2014 7:14 pm

How to change file date to creation date ?

Post by ec91066 »

Hello,

I had to recover some fotos that have been erased from my archive by error :oops: . However, now these files present the date they were recovered, not the creation date when fotos were taken.

I want to change date to creation date in linux, not going to buy some software to do it on windows 8) .

Any suggestions will be appreciated.

Thanks.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
WharfRat

Re: How to change file date to creation date ?

Post by WharfRat »

If you used the cp command the -a option preserves the original time, same as rsync with the -a option.

Whatever you used, you didn't specify, should have an option to preserve the date/time of the original file.
kukamuumuka

Re: How to change file date to creation date ?

Post by kukamuumuka »

One way is to pack file(s) and unpack the package.
ec91066
Level 1
Level 1
Posts: 35
Joined: Wed Mar 26, 2014 7:14 pm

Re: How to change file date to creation date ?

Post by ec91066 »

Hi WharfRat,

I have my archive mirrored in pCloud. I recovered my files from pCloud's trash folder but there's no option to set the original file date.

But I can see the creation date in the file's properties, so this information is not lost and it can be restored.

Thanks
kukamuumuka

Re: How to change file date to creation date ?

Post by kukamuumuka »

ec91066 wrote: Wed Oct 17, 2018 12:24 pm But I can see the creation date in the file's properties, so this information is not lost and it can be restored.
Install exiftool

Code: Select all

apt install libimage-exiftool-perl
Check picture's metadata via Terminal like

Code: Select all

exiftool mökki3.jpg
mökki3.png
http://xahlee.info/img/metadata_in_image_files.html
gm10

Re: How to change file date to creation date ?

Post by gm10 »

administrollaattori wrote: Wed Oct 17, 2018 12:34 pm
ec91066 wrote: Wed Oct 17, 2018 12:24 pm But I can see the creation date in the file's properties, so this information is not lost and it can be restored.
Install exiftool

Code: Select all

apt install libimage-exiftool-perl
Check picture's metadata via Terminal like

Code: Select all

exiftool mökki3.jpg
mökki3.png

http://xahlee.info/img/metadata_in_image_files.html
Right tool, wrong screenshot (that's the file date). Using exiftool, for all .jpg files in a folder this will set all file dates to their creation date as per their exif tag, if any:

Code: Select all

for F in *.jpg;do exiftool -createdate -d "%Y-%m-%d %H:%M:%S" "$F"|awk -F': ' '{print $2}'|xargs -r touch $F -d;done
Hoser Rob
Level 20
Level 20
Posts: 11806
Joined: Sat Dec 15, 2012 8:57 am

Re: How to change file date to creation date ?

Post by Hoser Rob »

administrollaattori wrote: Wed Oct 17, 2018 12:16 pm One way is to pack file(s) and unpack the package.
New users are often surprised to discover that Linux/Unix file systems do not support file creation date. They support time of last modification, last access, and last modification of the file's inode and that's it.

So packing and unpacking is probably a good way to go about it.
For every complex problem there is an answer that is clear, simple, and wrong - H. L. Mencken
gm10

Re: How to change file date to creation date ?

Post by gm10 »

Hoser Rob wrote: Thu Oct 18, 2018 8:00 amNew users are often surprised to discover that Linux/Unix file systems do not support file creation date. They support time of last modification, last access, and last modification of the file's inode and that's it.
And veteran users are often surprised by some of the statements you make (SCNR :P). Of course Linux file systems support creation time. Here, for example, for ext4:
https://github.com/torvalds/linux/blob/ ... xt4.h#L750

But as OP already explained, it doesn't matter in this case because he's only got a cloud backup.
Locked

Return to “Other topics”