Update inputrename.py.
This commit is contained in:
parent
b51c8032ac
commit
ef600c8f29
1 changed files with 8 additions and 11 deletions
|
@ -1,15 +1,15 @@
|
||||||
|
'''
|
||||||
|
Given a target string to replace, rename files by prompting the user for input.
|
||||||
|
'''
|
||||||
|
import argparse
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from voussoirkit import winglob
|
from voussoirkit import pipeable
|
||||||
|
|
||||||
import argparse
|
|
||||||
import sys
|
|
||||||
|
|
||||||
|
@pipeable.ctrlc_return1
|
||||||
def inputrename_argparse(args):
|
def inputrename_argparse(args):
|
||||||
pattern = f'*{args.keyword}*'
|
files = (file for file in os.listdir() if args.keyword in file)
|
||||||
|
|
||||||
files = winglob.glob(pattern)
|
|
||||||
prev = None
|
prev = None
|
||||||
for file in files:
|
for file in files:
|
||||||
print(file)
|
print(file)
|
||||||
|
@ -30,7 +30,4 @@ def main(argv):
|
||||||
return args.func(args)
|
return args.func(args)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
try:
|
raise SystemExit(main(sys.argv[1:]))
|
||||||
raise SystemExit(main(sys.argv[1:]))
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
raise SystemExit(1)
|
|
||||||
|
|
Loading…
Reference in a new issue