filenuke/filenuke/__init__.py

26 lines
542 B
Python
Raw Normal View History

2019-12-02 00:23:40 +00:00
#!/usr/bin/env python3
import sys
2019-12-02 09:04:17 +00:00
import os
2019-12-02 00:23:40 +00:00
try:
from . import nuke
except ImportError:
import nuke
2019-12-02 00:23:40 +00:00
if __name__ == "__main__":
2019-12-02 09:04:17 +00:00
try:
path_to_del = sys.argv[1]
except IndexError:
sys.exit(1)
if not os.path.exists(path_to_del):
sys.stderr.write(f'Path {path_to_del} does not exist\n')
sys.stderr.flush()
sys.exit(2)
2019-12-02 09:04:17 +00:00
if os.path.isfile(path_to_del):
nuke.clean(path_to_del)
else:
nuke.clean_tree(path_to_del)
print(f'Overwrote and deleted {path_to_del}')