tags:

views:

1136

answers:

4

Hello, can I change creating date of some file using python in Linux?

+2  A: 

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

Nadia Alramli
>Set the access and modified timesBut i need creating date.
Ockonal
Quote from the docs on that function: "Set the access and modified times of the file specified by path." .. so you can't use it to set the creation date.
Epcylon
It would be nice to add that there the concept of file creation date does not exist in most native *nix filesystems.
ΤΖΩΤΖΙΟΥ
A: 

You can use the [touch][1]-command to do this.

Example:

import os
cmd = 'touch...'
os.system(cmd)
alexn
+3  A: 

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

Nick D
+6  A: 

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

Ólafur Waage