summaryrefslogtreecommitdiff
path: root/download-images-fujix100v.py
diff options
context:
space:
mode:
Diffstat (limited to 'download-images-fujix100v.py')
-rwxr-xr-xdownload-images-fujix100v.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/download-images-fujix100v.py b/download-images-fujix100v.py
new file mode 100755
index 0000000..8c9df16
--- /dev/null
+++ b/download-images-fujix100v.py
@@ -0,0 +1,36 @@
+#! /usr/bin/python3
+import os
+from shutil import copyfile
+import sys
+
+
+if os.path.exists(sys.argv[1]):
+ path = os.path.abspath(sys.argv[1])
+else:
+ print("Cannot find " + sys.argv[1])
+ exit()
+with open('/home/lxf/.photocopyfujix100vrc', 'r') as f:
+ lastfile = str(f.readline().rstrip())
+sorter = []
+for (dirname, dirs, files) in os.walk(path):
+ dirn = os.path.abspath(dirname)
+ for filename in files:
+ if filename.endswith('.RAF'):
+ if int(filename.split('DSCF')[1].split(".RAF")[0]) > int(lastfile.split('DSCF')[1].split(".RAF")[0]):
+ sorter.append([int(filename.split('DSCF')[1].split(".RAF")[0]), filename])
+ elif filename.endswith('.JPG'):
+ if int(filename.split('DSCF')[1].split(".JPG")[0]) > int(lastfile.split('DSCF')[1].split(".RAF")[0]):
+ sorter.append([int(filename.split('DSCF')[1].split(".JPG")[0]), filename])
+
+for f in sorted(sorter):
+ dest = '/home/lxf/pictures/inbox/'
+ if not os.path.exists(dest):
+ os.makedirs(dest)
+ print("copying:", dirn+'/'+f[1], "--->", dest+f[1])
+ copyfile(dirn+'/'+f[1], dest+f[1])
+ try:
+ out = sorted(sorter)[-1]
+ with open('/home/lxf/.photocopyfujix100vrc', 'w') as f:
+ f.write(out[1])
+ except IndexError:
+ pass