Files last seen in snapshots

Hello all,

A folder has been deleted and I’m trying to recover it.
The thing is I don’t know when it was deleted so I’m trying to locate it in the snapshots.

I’ve used the list command:

 duplicacy list -r 1-400 -files | grep MyFolder > check.txt

In return I have a file with this (example):

     50111 2023-06-13 17:09:21 258ec5349a9a325195cc238ecd8c096df47c85a113b2a6473cf99a1b0b3f9b0f folder/subfolder/file.xlsx

And I don’t know what I can do with that data in order to restore my files since the restore command requires a snapshot ?

Any help appreciated.

lamaZZi

The snapshot info also printed between file dumps. You shall grep by some keywords there or your file. Then you will get both, snapshot and file.

duplicacy list --files | egrep "(^Snapshot|folder/subfolder/file\.xlsx)"

Thank you @saspus I see the output now: snapshot x, then the list of files, snapshot y, etc.
I think it would be more efficient to add the snapshot to each line.
But your solution work nonetheless.

You can do it of course, but the question is how much time do you want to invest in beautifying this :).

For example:

duplicacy list --files \
    | awk '/^Snapshot/ {rev = $4} /folder\/subfolder\/file\.xlsx/ {print rev ": " $5}

will produce something like this

 3: folder/subfolder/file.xlsx
 4: folder/subfolder/file.xlsx

You can go one step further and collect all the revisions that contain that file, and print them in the end:

duplicacy list --files \
    | awk '/^Snapshot/ {rev = $4} /folder\/subfolder\/file\.xlsx/ { revs = revs rev " " } END { print "Revisions: " revs}'

This will output something like this:

Revisions: 3 4

To make the more reusable, you can pass file path you are searching as a variable, and then wrap it into alias or shell script, if you do this frequently.

duplicacy list --files \
    | awk -v search="folder/subfolder/file.xlsx" \
    '/^Snapshot/ {rev= $4} $0~search { revs = revs rev " " } END { print "File " search " is present in revisions " revs}'

will produce:

File folder/subfolder/file.xlsx" is present in revisions 3 4

etc…

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.