Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

/dir/ect/ory/ contains n folders each containing r files. Of which a certain number are the same file with a different file extension. These files are both in the same folder. Is there a simple way to remove one file type but keep the other only a duplicate exists? For example:

/dir/ect/ory/1/myfile1.foo
/dir/ect/ory/1/myfile1.bar
/dir/ect/ory/1/myfile2.foo
/dir/ect/ory/1/myfile3.bar
/dir/ect/ory/2/myfile4.foo
/dir/ect/ory/2/myfile4.bar

Running the command would look something like the following:

duplicate-remove --recursive /dir/ect/ory/ --keep=*.bar

and would produce the result:

/dir/ect/ory/1/myfile1.bar
/dir/ect/ory/1/myfile2.foo
/dir/ect/ory/1/myfile3.bar
/dir/ect/ory/2/myfile4.bar

As you can see, I'm left with file1, file2, file3, file4 and no duplicates, but not all the files called *.foo were deleted, only the file with a *.bar duplicate.

Note also that it is only the file name I'm interested in comparing, not the the file size or data.

(A GUI program would be ok also)

share|improve this question
See here: askubuntu.com/questions/48524/… – Frantique Jan 31 at 10:30
possible duplicate of How to find (and delete) duplicate files – Eliah Kagan Jan 31 at 13:06
It isn't a duplicate of "How to find (and delete) duplicate files" because the files aren't duplicated, they're different files, some are compressed, some a different quality. It looks like it might be a duplicate of "Search for duplicate file names within folder hierarchy?" in @Frantique's comment. – captainjamie Jan 31 at 20:39
1  
See my link! It seems to me that it is what you are searching for! – Frantique Feb 1 at 8:54

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.