Python stat.ST_ATIME Examples
The following are 8
code examples of stat.ST_ATIME().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
stat
, or try the search function
.
Example #1
Source File: test_restore.py From backintime with GNU General Public License v2.0 | 6 votes |
def test_only_new(self): restoreFile = os.path.join(self.include.name, 'test') self.prepairFileInfo(restoreFile) with open(restoreFile, 'wt') as f: f.write('fooooooooooooooooooo') # change mtime to be newer than the one in snapshot st = os.stat(restoreFile) atime = st[stat.ST_ATIME] mtime = st[stat.ST_MTIME] new_mtime = mtime + 3600 os.utime(restoreFile, (atime, new_mtime)) self.sn.restore(self.sid, restoreFile, only_new = True) self.assertIsFile(restoreFile) with open(restoreFile, 'rt') as f: self.assertEqual(f.read(), 'fooooooooooooooooooo')
Example #2
Source File: cmodule.py From D-VAE with MIT License | 5 votes |
def last_access_time(path): """ Return the number of seconds since the epoch of the last access of a given file. """ return os.stat(path)[stat.ST_ATIME]
Example #3
Source File: cmodule.py From attention-lvcsr with MIT License | 5 votes |
def last_access_time(path): """ Return the number of seconds since the epoch of the last access of a given file. """ return os.stat(path)[stat.ST_ATIME]
Example #4
Source File: io.py From locasploit with GNU General Public License v2.0 | 5 votes |
def get_file_info(system, path, verbose=False): fullpath = get_fullpath(system, path) if fullpath == IO_ERROR: return IO_ERROR result = {} if system.startswith('/'): # local or sub if can_read(system, path): # TODO platform-specific stats = os.stat(fullpath) stm = stats.st_mode result['type'] = get_file_type_char(stat.S_IFMT(stm)) result['permissions'] = '%o' % (stat.S_IMODE(stm)) result['UID'] = stats[stat.ST_UID] result['GID'] = stats[stat.ST_GID] result['ATIME'] = stats[stat.ST_ATIME] result['MTIME'] = stats[stat.ST_MTIME] result['CTIME'] = stats[stat.ST_CTIME] # actually mtime on UNIX, TODO else: if verbose: log.info('File \'%s\' is not accessible.' % (fullpath)) result['type'] = None result['permissions'] = None result['UID'] = None result['GID'] = None result['ATIME'] = None result['MTIME'] = None result['CTIME'] = None return result else: # SSH/FTP/TFTP/HTTP # TODO NOT IMPLEMENTED return IO_ERROR
Example #5
Source File: frm_reader.py From mysql-utilities with GNU General Public License v2.0 | 5 votes |
def show_statistics(self): """Show general file and table statistics """ print "# File Statistics:" file_stats = os.stat(self.frm_path) file_info = { 'Size': file_stats[stat.ST_SIZE], 'Last Modified': time.ctime(file_stats[stat.ST_MTIME]), 'Last Accessed': time.ctime(file_stats[stat.ST_ATIME]), 'Creation Time': time.ctime(file_stats[stat.ST_CTIME]), 'Mode': file_stats[stat.ST_MODE], } for value, data in file_info.iteritems(): print "#%22s : %s" % (value, data) print # Fail if we cannot read the file try: self.frm_file = open(self.frm_path, "rb") except Exception, error: raise UtilError("The file %s cannot be read.\n%s" % (self.frm_path, error)) # Read the file type
Example #6
Source File: util.py From incremental-reading with ISC License | 5 votes |
def updateModificationTime(path): accessTime = os.stat(path)[stat.ST_ATIME] modificationTime = time.time() os.utime(path, (accessTime, modificationTime))
Example #7
Source File: filepath.py From BitTorrent with GNU General Public License v3.0 | 5 votes |
def getatime(self): st = self.statinfo if not st: self.restat() st = self.statinfo return st[ST_ATIME]
Example #8
Source File: jardiff.py From jardiff with Apache License 2.0 | 5 votes |
def _write_infos_to_temp(temp_folder, original_stat, infos): times = (original_stat[stat.ST_ATIME], original_stat[stat.ST_MTIME]) for name, info in infos.items(): out = os.path.join(temp_folder, name) with open(out, 'w') as f: f.write(info) os.utime(out, times)