Organising a huge number of images is tiresome, and especially searching for duplicate images with different names. To alleviate this burden I decided to write a little utility that'd help me find images with identical sizes and SHA-1 hashes.
Everything works great, except interaction with other applications.
When the user passes "-q" to the application, output is supposed to be limited to only the filenames of possible duplicate files, discarding other diagnostic info. The purpose of this is to make it easier to use the utility with other applications. One might first run the application in its normal mode of operation, to find out if there are any possible dupes. If there are any, we might want to take some action. For example, opening all the suspects in Firefox, to confirm that they are indeed the same.
This is where I run into trouble.
$ ./dupsearch -q Mai.Otome.HiME-Yuripack
'Mai.Otome.HiME-Yuripack/Mai Hime - 079.gif' 'Mai.Otome.HiME-Yuripack/fanart_08_15.gif' 'Mai.Otome.HiME-Yuripack/Mai Hime - 013.jpg' 'Mai.Otome.HiME-Yuripack/mr_cg160.jpg'
As you can see, the application outputs all of the filenames in single quotes. If we copy this and paste it into the terminal, it works just fine:
$ mozilla-firefox 'Mai.Otome.HiME-Yuripack/Mai Hime - 079.gif' 'Mai.Otome.HiME-Yuripack/fanart_08_15.gif' 'Mai.Otome.HiME-Yuripack/Mai Hime - 013.jpg' 'Mai.Otome.HiME-Yuripack/mr_cg160.jpg'
However, this is a real bother, especially when there are lots of duplicate images. Therefore I'd do something like this:
$ mozilla-firefox `./dupsearch -q Mai.Otome.HiME-Yuripack`
This works fine - as long as none of the file or directory names contain any spaces. When there are spaces, it seems that the shell decides that each space denotes a new parameter, even when the space is part of a quoted word.
This is a bit weird, seeing as it works fine with the same data if you copy and paste it.
Does anyone have any suggestions about what I could do to fix this?
I'm using bash on a Debian Unstable system.