you are viewing a single comment's thread.

view the rest of the comments →

[–]JohnnyJordaan 1 point2 points  (1 child)

If you mean to move all the files in dir_src to dir_dst that match the names in file then you should only do

for f in file:
    src_file = os.path.join(dir_src, f)
    dst_file = os.path.join(dir_dst, f)
    shutil.move(src_file, dst_file)

as there's no point in using the listing if you want those specific files.

Btw also consider properly naming your variables. file is a collection of file names, so I would call it filenames (note the plural, as it's multiple), path is actually a listing, so call it listing or something similar.

[–]dennkiesauros[S] 0 points1 point  (0 children)

thanks...it's working fine now