Max Frai
Max Frai

Reputation: 64276

Change file creation date

Can I change creation date of some file using Python in Linux?

Upvotes: 18

Views: 27844

Answers (5)

Gringo Suave
Gringo Suave

Reputation: 31880

It's no longer true that Linux doesn't support creation time. See:

Note this specific answer to view C-code that displays the field:

If the author of that post can help I might be able to create a wrapper with ctypes to modify it from Python.

Upvotes: 3

dahoiv
dahoiv

Reputation: 85

Check out os.utime

os.utime(file_path,(new_atime,new_mtime))

Upvotes: 2

Ólafur Waage
Ólafur Waage

Reputation: 70001

Linux and Unix file system stores :

File access, change and modification time (remember UNIX or Linux never stores file creation time, this is favorite question asked in UNIX/Linux sys admin job interview)

Understanding UNIX / Linux file systems

Upvotes: 18

Nick Dandoulakis
Nick Dandoulakis

Reputation: 43120

I am not a UNIX expert, so maybe I'm wrong, but I think that UNIX (or Linux) don't store file creation time.

Upvotes: 2

Nadia Alramli
Nadia Alramli

Reputation: 114943

You can use os.utime to change access and modify time but not the creation date.

Upvotes: 17

Related Questions