Operation check
Raspberry Pi2 + raspbian
In order to copy the line monitor log file in folder units, it was done as follows.
shutil.copytree(srcpath, dstpath + "/Log/")
However, last night, even if I took a log while doing a continuous communication test, I could only get a log of daytime work. It seemed that the file overwrite failed.
Reference 1. Question that cannot be overwritten @ SO Reference 2. To use distutils.dir_util.copy_tree () @ SO
I changed it as follows. Change commit @ github
#!/usr/bin/env python
'''
+v0.2 2015 Dec. 13
+ - fix bug > did not overwrite files
v0.1 2015 Dec. 12
- add USB memory insertion recognition
- add folder copy feature
@@ -20,6 +22,8 @@
import os.path
import sys
import time
+import distutils
+from distutils import dir_util
param = sys.argv
@@ -36,7 +40,7 @@
if os.path.isdir(srcpath) and os.path.isdir(dstpath):
if chk1==False and chk2==False and chk3==True:
print "inserted"
- shutil.copytree(srcpath, dstpath + "/Log/")
+ distutils.dir_util.copy_tree(srcpath, dstpath + "/Log/")
print "Copied"
time.sleep(0.5)