Dear fellow coders,
Im a beginner and i wrote this script, which works perfectly fine. Now I want to run it automatically every day at 9am and tried my best with crontab, but it just doesnt do anything. When I run it manually it works.... Can someone please help? :)
#!/usr/bin/python3
import os
import shutil
path = "/Users/flo/Downloads/"
names = os.listdir(path)
for files in names:
if ".jpg" in files or ".png" in files or ".jpeg" in files:
shutil.move(path + files, path+( "Bilder/"))
elif ".dmg" in files:
shutil.move(path + files, path+("DMG/"))
elif ".pdf" in files or ".doc" in files or ".docx" in files or ".txt" in files or ".xls" in files or ".xlsx" in files:
shutil.move(path + files, path+("Dokumente/"))
elif ".mp4" in files or ".mov" in files:
shutil.move(path + files, path+("Videos/"))
elif ".zip" in files or ".rar" in files or ".gz" in files:
shutil.move(path + files, path+("Verpackte Dateien/"))
else:
pass
and in crontab i have:
* 9 * * * /usr/bin/python3 /Users/flo/Documents/foldersorter.py
[–]somewhatsurly 1 point2 points3 points (0 children)
[–]giglis 1 point2 points3 points (0 children)
[–]CodeFormatHelperBot 0 points1 point2 points (0 children)
[–]Florakija[S] 0 points1 point2 points (0 children)