Delete identical files from 2 different locations

ساخت وبلاگ

well I don't know how to describe my problem with just a few words so the title can be misleading. Sometimes I download a module, it's a zip file that I extract to 'my_folder' so it sound slike this:

my_folderpath1file1.txt

my_folderpath1file2.txt

my_folderpath2file3.txt

let's say I have another folder somewhere like this:

my_new_folderpath1file10.txt

my_new_folderpath2file20.txt

as you can see they don't have files in common, but they have path in common (path1 and path2 have the same name)

now I copy the full content of my_folder to my_new_folder, now my_new_folder looks like this,

my_new_folderpath1file1.txt

my_new_folderpath1file2.txt

my_new_folderpath1file10.txt

my_new_folderpath2file20.txt

my_new_folderpath2file3.txt

My question is, days after I did that, how can I automate the removal of all Files I have copied?

assuming 'my_folder' is still there, it could be used as a reference, to search in 'my_new_folder' all files with the same path/filename from 'my_new_folder', and remove them, so my_folder looks like this :

my_new_folderpath1file10.txt

my_new_folderpath2file20.txt

what matters is I can't only compare filename, I need to include the full path (except root) because maybe file1.txt exists in multiple folders (someone create a file with the same name in path3 for instance), but then I want to keep my_new_folderpath3file1.txt and only remove my_new_folderpath1file1.txt

thanks for any help, Rod

Recent Questions...
ما را در سایت Recent Questions دنبال می کنید

برچسب : delete identical files,delete identical files linux,delete identical files mac,delete duplicate files,delete duplicate files mac,delete duplicate files windows,delete double files,delete duplicate files windows 8,delete duplicate files free,delete duplicate files in itunes, نویسنده : استخدام کار superuser بازدید : 429 تاريخ : شنبه 30 مرداد 1395 ساعت: 14:51