|go ahead... be a heretic|
Dealing with an Interactive Prompt - (rclone dedupe)by YenForYang (Beadle)
|on Feb 12, 2018 at 18:06 UTC||Need Help??|
YenForYang has asked for the
wisdom of the Perl Monks concerning the following question:
I know Expect.pm is probably the right tool for this job, but the tutorials don't seem to contain what I want to do.
So here's what rclone dedupe does. It's a command that may be run to remove duplicate files on Google Drive (which allows for duplicate filenames). Unfortunately rclone dedupe doesn't have an option for what I'm trying to do: remove the duplicate with the smaller size (i.e. keep the larger one). Heres the dialog that appears when I enter rclone dedupe GD:somefolder (the default command with interactivity) into the terminal (bolded text indicates things that can vary for different files):
2018/02/12 11:26:12 NOTICE: This is a file.ext: Found 2 duplicates - deleting identical copies This is a file.ext: 2 duplicates remain 1: 5010566 bytes, 2018-02-12 17:26:04.941000000, md5sum 5955c7ee02c216b7575354532463911e 2: 694653 bytes, 2018-02-12 17:24:27.232000000, md5sum 5a4d64696f37ffe83d4bf5ec14e28847 s) Skip and do nothing k) Keep just one (choose which in next step) r) Rename all to be different (by changing file.jpg to file-1.jpg) s/k/r>
In the terminal, I would press letter k and Enter, which would then show: Enter the number of the file to keep>
So really the issue is that I have to extract the file sizes, compare them, select the number corresponding to the duplicate (note that there can be more than 2), enter the number after entering k. After doing so, say I select 1 after k, I get this notice:
2018/02/12 11:55:00 NOTICE: This is a file.ext: Deleted 1 extra copies
I'm still currently thinking about this, I just wanted to post this in case someone who really knows how to handle things like this has some pointers in the meantime.