Hey all,
I have the following code that is working fine; basically it finds all files on my desktop and then prints the specific ones that I am looking of.
I save all files to my desktop and the files contain the clients name so I figure once a week I can clean my desktop by sending the files off to where they live in the correct directories.
Here is what I have so far...
import glob
import os
os.chdir("d:\Desktop")
for files in glob.glob("*.*"):
x = str(files).lower()
if 'client_name' in x:
print x
The next bit is to gt the fild to actually move, I found this in another thread but I'm having trouble getting them to play together!
import os
import shutil
# make sure that these directories exist
dir_src = "d:\Desktop"
dir_dst = "d:\Desktop\New folder"
for file in os.listdir(dir_src):
print file # testing
src_file = os.path.join(dir_src, file)
dst_file = os.path.join(dir_dst, file)
shutil.move(src_file, dst_file)
I'd be greatful if anyone can help me out or direct me in the right direction.
Thanks :)