2016-12-05 01:50:52 +00:00
|
|
|
'''
|
|
|
|
Create the file, or update the last modified timestamp.
|
|
|
|
'''
|
2016-11-18 06:24:52 +00:00
|
|
|
import glob
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
2016-12-23 03:42:21 +00:00
|
|
|
from voussoirkit import safeprint
|
|
|
|
|
2016-12-13 03:53:21 +00:00
|
|
|
def touch(glob_pattern):
|
2016-11-18 06:24:52 +00:00
|
|
|
filenames = glob.glob(glob_pattern)
|
|
|
|
if len(filenames) == 0:
|
2016-12-23 03:42:21 +00:00
|
|
|
safeprint.safeprint(glob_pattern)
|
2016-11-18 06:24:52 +00:00
|
|
|
open(glob_pattern, 'a').close()
|
|
|
|
else:
|
|
|
|
for filename in filenames:
|
2016-12-23 03:42:21 +00:00
|
|
|
safeprint.safeprint(filename)
|
2016-11-18 06:24:52 +00:00
|
|
|
os.utime(filename)
|
2016-12-13 03:53:21 +00:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
glob_patterns = sys.argv[1:]
|
|
|
|
for glob_pattern in glob_patterns:
|
|
|
|
touch(glob_pattern)
|