aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Liodden <[email protected]>2017-12-18 18:02:31 +0100
committerErik Liodden <[email protected]>2017-12-18 18:02:31 +0100
commitea09b72776478ec86decc863d7431eb593261ac5 (patch)
tree2b6a3a103e5333d259283810b7888c7752404726
parented1aac5a07b91146f2bf14f0fa192f3e8c2caa60 (diff)
downloadboil-me-baby-ea09b72776478ec86decc863d7431eb593261ac5.tar.gz
add path as argumentHEADmaster
this makes it possible to run the program in a different folder
-rw-r--r--min4.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/min4.py b/min4.py
index 081dfaa..f16218c 100644
--- a/min4.py
+++ b/min4.py
@@ -7,6 +7,7 @@ import os
from subprocess import call
import glob
from datetime import datetime
+from sys import argv
_OLD = datetime.now().year - 4
@@ -27,7 +28,19 @@ def organise_dir(directory):
call(['rm', '-rf', src])
def main():
- d = next(os.walk('.'))[1]
+ try:
+ path = argv[1]
+ except:
+ path = '.'
+
+ if path[-1] != '/':
+ path += '/'
+
+ d_temp = next(os.walk(path))[1]
+ d = []
+ for item in d_temp:
+ d.append(path + item)
+
for sd in d:
organise_dir(sd)
return 0