【发布时间】:2013-12-12 21:15:46
【问题描述】:
我正在尝试查找一些文件,创建一个文件夹并将文件移动到那里。
def test():
try:
logfile = "C:\\Users\\alkis\\Desktop\\testouter\\test"
result_dir = os.path.join(logfile, "testzip")
print result_dir
os.makedirs(result_dir)
os.chmod(result_dir, stat.S_IWRITE)
kpath = logfile + "\\*.jpg"
print kpath
files = glob.glob(kpath)
for file in files:
filename = os.path.splitext(file)[0]
print filename
os.chmod(filename, stat.S_IWRITE)
shutil.move(filename, result_dir)
except Exception, e:
#shutil.rmtree(result_dir)
print e.__doc__ + "\r\n"
print e.message
return
我得到的错误是:MS-Windows OS call failed
我检查了我的文件的权限,它们不是只读的。
【问题讨论】: