Can't copy files?
IOError: [Errno 13] Permission denied:
import shutil, os, sys src = r"R:\natura 2000\8847.04 MaP\6417-341_Weschnitz_Bergstrasse_Odenwald" dest = "H:\\test" ret = os.access(src, os.F_OK) print "F_OK - return value %s"% ret ret = os.access(src, os.R_OK) print "R_OK - return value %s"% ret ret = os.access(src, os.W_OK) print "W_OK - return value %s"% ret ret = os.access(src, os.X_OK) print "X_OK - return value %s"% ret shutil.copyfile(src, dest)
F_OK - return value True
R_OK - return value True
W_OK - return value True
X_OK - return value True
Traceback (most recent call last):
File "R:\Karto\zGIS\Python\OrdnerKopieren.py", line 86, in <module>
shutil.copyfile(src, dest)
File "C:\Python27\ArcGIS10.1\lib\shutil.py", line 81, in copyfile
with open(src, 'rb') as fsrc:
IOError: [Errno 13] Permission denied: 'R:\\natura 2000\\8847.04 MaP\\6417-341_Weschnitz_Bergstrasse_Odenwald'
Any idea why?
Solved! Go to Solution.
If it is a matter of speeding up the copy process of large files, you may want to look at this article: Faster Python File Copy - Blumetech's Tech Blog
If you want to record the time it took to copy the file, you can record the current time just before and just after and determine the timedelta or read the post by Owen Earley: https://community.esri.com/thread/119781#448946
From the documentation:
shutil.copyfile(src, dst)
Copy the contents (no metadata) of the file named src to a file named dst. dst must be the complete target file name; look at copy() for a copy that accepts a target directory path.
Thanks, but didn't helped. shutil.move does work?
Do u know how to print information about copy speed?
If it is a matter of speeding up the copy process of large files, you may want to look at this article: Faster Python File Copy - Blumetech's Tech Blog
If you want to record the time it took to copy the file, you can record the current time just before and just after and determine the timedelta or read the post by Owen Earley: https://community.esri.com/thread/119781#448946
Thanks Xander.
Nontheless this was the best solution for me:
if sys.platform == 'win32':
os.system('xcopy "%s" "%s"' % (src, dest) + " /Y /M /S /E")
else:
shutil.copy(src, dest)