【发布时间】:2020-06-10 19:40:14
【问题描述】:
我有 3 个文件夹
Folder A (Landing Folder)
Folder B (Deletion Folder)
Folder C (Transfer to AWS Folder)
我已经编写了一些 python 代码,以便在进行一些数据转换后,从登录文件夹将文件移动到登录文件夹 - 我需要为文件制作决策树:
Check each filename in folder A to see if it exists in the database
if the file exists already:
move the file to Folder B
Else
Insert the file name into the Database & move the file to Folder C for transfer to AWS
我在 python 中测试并运行了 SQL 语句,但我不确定如何将文件移动到它们各自的文件夹中。
我假设我需要一些类似于使用 shutil.move 到文件夹 B 或 C 的东西,具体取决于结果,但不能 100% 确定到达那里的语法。
任何帮助表示赞赏。
【问题讨论】:
-
我刚刚编辑了我的答案,希望对您有所帮助。
-
@MrNobody33 - 是的,这个答案很棒,我可以从中构建一些东西!感谢您的协助
标签: python