LS -l command & Timestamps

Status
Not open for further replies.

C.Taylor453

New Member
Joined
Aug 10, 2021
Messages
2
Reaction score
0
Credits
21
Hi,

So I am aware that the date shown in Linux CLI (when doing "ls -l" is the modification date. Is this the modification date that the content of the file has changed or when metadata such as file name has changed?

Also is there anyway to find created timestamps for files?

Again if I wanted to copy/tar files off in bulk but preserve the created date of a file is this possible?

I believe cp -p and tar -p only preserves the modification date.

Thanks in advance.
 


If you want the meta data of the file, you can stat it.
Code:
stat filename.txt

it's not super granular, but it will give you good information about the file.
 
Hi,

Thanks for that, I did try stat previously but it didn't have anything for the "birth" date for the few files i tested.

I also need to copy/tar the files (thousands of files) to a separate drive whilst preserving metadata.

Thanks
 
Last edited:
I believe the birthday or format %W / %w options are highly dependent on the filesystem the file is on. I do not believe any of the ext filesystems support this metadata value.

This data may not be available for you to retrieve depending on the filesystem you're using. (I'm not even sure which filesystems would support it, though, given the option for stat being available, I'm sure there must be at least one that does.
 
ext4 seems to be support crtime, as for copying over files rsync should be able to do it.
rsync -avz foo:src/bar /data/tmp

This would recursively transfer all files from the directory src/bar on the machine foo into the /data/tmp/bar
directory on the local machine. The files are transferred in "archive" mode, which ensures that symbolic links,
devices, attributes, permissions, ownerships, etc. are preserved in the transfer. Additionally, compression will
be used to reduce the size of data portions of the transfer.
 
ext4 seems to be support crtime, as for copying over files rsync should be able to do it.
rsync no,
https://github.com/WayneD/rsync/issues/166#issuecomment-812968810

I've tried a lot of sync software, but I can't keep the creation time,
Only disk-level backup software can be used such as the dd command






 
Last edited:
In Windows,
We mount the ext4 partition using github /matt-wu/Ext3Fsd. Then the ext partition is mounted on the windows system just like the local partition and accesses normally as with NTFS,

At this time, we can use some software under windows, such as: rsync, SyncToy, UrBackup and other software that can retain the file creation time in windows, we synchronize the ntfs file to EXT4,
Compare their creation time, and then mount it to the deeping Linux system in ext4, compare their creation time, which has been kept synchronized.

?? Windows uses github matt-wu/Ext3Fsd to preserve the creation time, but Linux cannot
What is the specific reason
 
@mygit welcome to linux.org.

What is the specific reason

Do be aware that this Thread is 2 years and nearly 4 months old, and that the OP (Original Poster) has not been seen since a week after they posted.

Cheers

Chris Turner
wizardfromoz
 
Hi,

So I am aware that the date shown in Linux CLI (when doing "ls -l" is the modification date. Is this the modification date that the content of the file has changed or when metadata such as file name has changed?

Also is there anyway to find created timestamps for files?

Again if I wanted to copy/tar files off in bulk but preserve the created date of a file is this possible?

I believe cp -p and tar -p only preserves the modification date.

Thanks in advance.
It seems like modification time refers to either a) when the file was created or b) the last time the file was saved. When I change the name of a file with mv, this doesn't effect the modification time. However, it should be noted, that if you save or create a file, it also appears to change the modification time of the directory its in. So, I suppose you want to copy without changing the modification time?

Also, i prefer to use the "ls -rt" command. This does not show the modification time, but lists the file, with the more newly modified files at the bottom. To me, this is the best way to view the files in a directory, but "ls -l" lists a ton of file features.
 
Hello,,, did you read what I said above?

Do be aware that this Thread is 2 years and nearly 4 months old, and that the OP (Original Poster) has not been seen since a week after they posted.

Wizard
 
Status
Not open for further replies.

Members online


Latest posts

Top