Linux uses Ctime/mtime/atime to mark document time,
CTIME:C does not represent create but the change meaning, such as the modification of the contents of the file changes will be changed CTime
Mtime:m is modify meaning, and ctime the only difference is that permission modification has no effect on it
Atime:a is the time that a file is accessed, such as when you open a file, even if there are no changes to it, it will have an impact on the time.
In order to facilitate learning to write a script, the main function is to display the file three kinds of time, you can choose a file to do the following, see the changes in the status of the file, to deepen the understanding of the text time.
A) touch,
b) Turn it off without modification,
c) Open the changes and then close to see the current status of the file.
#!/usr/bin/env pythonimport subprocessimport argparseimport os.path, timedef script (cmd): print cmd Subprocess.call (cmd, shell=true) if __name__ = = "__main__": parser = Argparse. Argumentparser () parser.add_argument ("-F", "--file", help= "The directory for the file") args = Parser.parse_args () if args.file: print "Start Script" print "CTime (change Time ):%s"% Time.ctime (Os.path.getctime (args.file)) Print "Mtime (last Modified):%s"% Time.ctime (Os.path.getmtime (args.file)) print "Atime ( Access time):%s"% Time.ctime (Os.path.getatime (args.file)) print "End Script" else: parser.print_help ()
Linux Ctime/mtime/atime