我试图创建一个脚本,将只移动新的或更新的文件从过去的24小时到一个新的文件夹。我创建了一个脚本,到目前为止,将移动一般的文件,任何线索或建议将不胜感激。你知道吗
import os, shutil
source = os.listdir('C:\Users\Student\Desktop\FolderA')
destination = 'C:\Users\Student\Desktop\FolderB'
os.chdir('C:\Users\Student\Desktop\FolderA')
for files in os.listdir("C:\Users\Student\Desktop\FolderA"):
if files.endswith(".txt"):
src = os.path.join("C:\Users\Student\Desktop\FolderA",files)
dst = os.path.join(destination,files)
shutil.move(src,dst)
我相信我找到了解决办法,让我知道你们的想法。你知道吗
相关问题 更多 >
编程相关推荐