Saturday, January 6, 2024

Re: DirDiffVim for folders, but files are missed?

hi,

(you do realise we're somewhat OT for this forum ? :-))

On Sat, 6 Jan 2024 at 15:00, K otgc <konthegoldcoast@gmail.com> wrote:
> Thanks.
> I ran these commands, and I'm up to the final step of using those hash values to look up all the matching filenames in the original md5 file.
> I'm researching a command for that, as command fdupes seems to be for files, but I need to match up the md5 hash values?
> ubuntu@ubuntu:~/Documents$ find -H test1/ ! -type d -exec md5sum {} + > sum.md5
> ubuntu@ubuntu:~/Documents$ ls
> NoMachine sum.md5 test1 test2
> ubuntu@ubuntu:~/Documents$ cat sum.md5
> 3bc3be114fb6323adc5b0ad7422d193a test1/test1.1/test1.1.1/test1.1.1file2.JPG
> 126a8a51b9d1bbd07fddc65819a542c3 test1/test1.1/test1.1.1/test1.1.1file1.JPG.json
> 3e7705498e8be60520841409ebc69bc1 test1/test1.1/test1.1.1/test1.1.1file1.JPG
> d8e8fca2dc0f896fd7cb4cb0031ba249 test1/test2/test2.2/test2.2.2/test2.2.2file1.JPG
> 126a8a51b9d1bbd07fddc65819a542c3 test1/test2/test2.2/test2.2.2/test1.1.1file1.JPG.json
> d8e8fca2dc0f896fd7cb4cb0031ba249 test1/test2/test2.2/test2.2.2/test2.2.2file1.JPG.json
> ubuntu@ubuntu:~/Documents$ sort|uniq -c|sort -nr sum.md5 |cut -d ' ' -f1
> 126a8a51b9d1bbd07fddc65819a542c3
> 126a8a51b9d1bbd07fddc65819a542c3
> 3e7705498e8be60520841409ebc69bc1
> 3bc3be114fb6323adc5b0ad7422d193a
> d8e8fca2dc0f896fd7cb4cb0031ba249
> d8e8fca2dc0f896fd7cb4cb0031ba249


ubuntu@ubuntu:~/Documents$ find -H test1/ ! -type d -exec md5sum {} + > sum.md5

why not use '-type f' ? anyway, the following should do what you look for:

$ find -H test1/ ! -type d -exec md5sum {} + | awk -f kotgc.awk

the awk code is:
-----<snip>-----
{
if ($1 in arr)
arr[$1] = arr[$1] ", " $2
else
arr[$1] = $2
}

END {
for (m in arr)
if (arr[m] ~ ".*,.*")
print m " " arr[m]
}
-----<snip>-----

--
regards, jr.

You have the right to free speech, as long as you're not dumb enough
to actually try it.
(The Clash 'Know Your Rights')

this email is intended only for the addressee(s) and may contain
confidential information. if you are not the intended recipient, you
are hereby notified that any use of this email, its dissemination,
distribution, and/or copying without prior written consent is
prohibited.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAM-dBgrHoAXZ5ucWnSxRaWzsgHk1D6qjXQnZjT8E8qtq2yvz4w%40mail.gmail.com.

No comments: