I have list of files like below :
['/home/Test//A/Aa/hello1.c', '/home/Test/C/Aa/hello1.c', '/home/Test/B/Aa/hello1.c']
I'm trying to move all those files from that path to another path. When I find the same filename, I need to replace the existing one as I somehow wanted to remove those files from the existing path, so replace I need to do if same filename exists as they are same files.
Tried as below :
import shutil
list_l1 = ['/home/Test//A/Aa/hello1.c', '/home/Test/C/Aa/hello1.c', '/home/Test/B/Aa/hello1.c']
for source in list_l1:
shutil.move(source, '/home/AShekar/sample_try/sample/')
I have received error as File "/usr/lib/python2.7/shutil.py", line 292, in move raise Error, "Destination path '%s' already exists" % real_dst
Thanks in advance!!