If you merely want to check for duplicates under the galleries folder and get a list of files (which you then can work with), save the following code as a duplicates.sh shell script and give it the execute bit and invoke it in your Piwigo folder (above the galleries folder). Ensure you keep and don't omit the two apostrophe / single quote characters that enclose the awk script when copy-pasting the code.
#!/bin/sh find galleries -type f -print0 | xargs -0 md5sum | awk ' { ++s[$1]; f[$1][s[$1]] = $2 } END { for (x in s) { if (s[x] > 1) { for (i in f[x]) print x, f[x][i] } } } '
This script can be adjusted to also check files under the upload directory by simply adding that to the list of find directories, as in find galleries upload -type f ...
This needs gawk for true multidimensional arrays. If you happen to have only mawk or another inferior awk implementation you're out of luck and need to rewrite.
Offline