To touch a file in python, do the following:
import os
def touch(fname, times=None):
"""
touch - change file timestamps
"""
with file(fname, 'wa'):
os.utime(fname, times)
if __name__ == '__main__':
for i in range(0, 10):
filename = 'somefile{i}.txt'.format(i=i)
print(filename)
touch(filename)
Comments
Leave a Reply