I have just started to learn python (Learning Python), and I am trying to move some files to another folder that are over a week old. I keep getting an error about the files not existing.
import shutil, sys, time, os
src = 'c:/users/wca36050/temp1'
dst = 'c:/users/wca36050/temp2'
now = time.time()
for f in os.listdir(src):
if os.stat(f).st_mtime < now - 7 * 86400:
if os.path.isfile(f):
shutil.move(f, dst)
Error I am getting: "WindowsError: [Error 2] The system cannot find the file specified: 'pic.jpg'"
The file does exist. I know I am probably doing something stupid. Any ideas?
Thanks!