Python recursive find files and move to one destination directory

隐身守侯 提交于 2019-12-01 21:55:59

Congratulations! You have already found os.path.join(). You even use it, on your print call. So you only have to use it with move():

shutil.move(os.path.join(root, filename), os.path.join(destDir, filename))

(But take care not to overwrite anything in destDir.)

Change the root + filename in the last line to os.path.join(root, filename) (as seen two lines earlier)?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!