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
|
|
|
|
|
2018-09-30 08:48:41 +00:00
|
|
|
from voussoirkit import clipext
|
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__':
|
2018-09-30 08:48:41 +00:00
|
|
|
glob_patterns = [clipext.resolve(x).strip() for x in sys.argv[1:]]
|
2016-12-13 03:53:21 +00:00
|
|
|
for glob_pattern in glob_patterns:
|
|
|
|
touch(glob_pattern)
|