jhnc / findimagedupes

Finds visually similar or duplicate images
GNU General Public License v3.0
104 stars 8 forks source link

Feedback about a few difficulties a newbie may face #18

Closed slrslr closed 5 months ago

slrslr commented 5 months ago

I have been told to open this issue regarding a few things I have mentioned at: https://github.com/jhnc/findimagedupes/issues/16#issuecomment-2158086824

You have provided answer to only one of the things mentioned and that is: wc < <( ls ) (although ls | wc is simpler)

I have tried: findimagedupes -f /dev/shm/fpdb-nonrecur-git -t 95% -- - <( ls -A1 "/dir name/" ) but that does nothing/command looks hang for half a day with no resources utilization

jhnc commented 5 months ago

<(cmd) is a bash feature to make command output look like a file (aka "process substitution"). Note that my example to use this as stdin had an additional <. bash converts wc < <(ls) into something like wc < /dev/fd/63.

See:

This is similar (but there are important differences) to: ls | wc

See:

When using process substitution with findimagedupes, the extra < (with space) is essential.


findimagedupes expects to be run with some options followed by some file and/or directory names. It creates the list of files it will process by adding each provided file name, and expanding any provided directories into the files they contain and adding those.

If we consider your commandline:

findimagedupes -f /dev/shm/fpdb-nonrecur-git -t 95% -- - <( ls -A1 "/dir name/" )

it has form:

findimagedupes option option -- get-filelist-from-stdin file

file is the result after bash substitutes <(ls -A1 "/dir name/"), something like:

findimagedupes -f /dev/shm/fpdb-nonrecur-git -t 95% -- - /dev/fd/63

Observe that you have specified - which tells findimagedupes to read a list of files from stdin. It will try to do that before it processes the filename that follows. However stdin has not been redirected from anywhere (there is no | nor <). So findimagedupes is waiting to read input from your terminal!

The necessary format to redirect stdin is:

findimagedupes options -- - <file

or:

cmd | findimagedupes options -- -

In your example, this should have been:

findimagedupes -f /dev/shm/fpdb-nonrecur-git -t 95% -- - < <( ls -A1 "/dir name/" )

or (more simply):

ls -A1 "/dir name/" | findimagedupes -f /dev/shm/fpdb-nonrecur-git -t 95% -- -

Not including that extra < made a huge difference to the meaning of your command.

slrslr commented 5 months ago

Thanks for addressing one of the several things i have mentioned.