Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Dealing with an Interactive Prompt - (rclone dedupe)

by YenForYang (Beadle)
on Feb 12, 2018 at 18:06 UTC ( #1209013=perlquestion: print w/replies, xml ) Need Help??
YenForYang has asked for the wisdom of the Perl Monks concerning the following question:

I know 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)

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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1209013]
Approved by Corion
Front-paged by haukex
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2018-08-16 15:34 GMT
Find Nodes?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:

    Results (168 votes). Check out past polls.