kmwoley / restic-windows-backup

Powershell scripts to run Restic backups on Windows
MIT License
329 stars 68 forks source link

restore not work correct #61

Closed ale82x closed 2 years ago

ale82x commented 2 years ago

Hello, sorry for asking. but i try from some pc and i have same behaviour.

i setup restic backup on my pc and notebook. i try to restore a single file for testing but don't work.

i have on my desktop a single file.zip (4,66 MB) to restore i use cd c:\restic\ .\restic.exe -r 'rclone:mydrive:/restic-notebook' ls -l latest /C/Users/myusername/Desktop/ ... -rw-rw-rw- 0 0 4888237 2021-12-22 16:33:41 /C/Users/myusername/Desktop/PrinterMeterReading.zip

so size seems ok. then i try to restore .\restic.exe -r 'rclone:mydrive:/restic-notebook' dump latest /C/Users/myusername/Desktop/PrinterMeterReading.zip > /Users/myusername/Desktop/PrinterMeterReading2.zip

file is restore but when i try to open , i have an error that is not ana archive file...

so i check size and is 9,39 MB seem restore double size....

can you help me to debug? thank you

rawtaz commented 2 years ago

You might want to use the restore command for that instead of dump. Restore is meant to restore one or more files. Dump is meant to output one or more files as an archive.

When you run dump like you do, it should output a tar archive. Please run .\restic.exe help dump to see the available options to that command (if you really want an archive file instead of the file as it is), or .\restic.exe help restore if you want to just restore the file as it is (without wrapping it in another archive by restic).

ale82x commented 2 years ago

thank you, exactly i should use restore

now i'm able to restore my files with .\restic.exe -r 'rclone:mydrive:/restic-notebook' restore latest --include "/C/Users/myusername/Desktop/PrinterMeterReading.zip" --target "C:\Users\myusername\Downloads\"

but restic restore entire path so i find my file in this folder "C:\Users\myusername\Downloads\C\Users\myusername\Desktop\PrinterMeterReading.zip"

on restic docs i can't find a flag to set restore without absolute path https://restic.readthedocs.io/en/latest/050_restore.html

but when i try dump, restore is wrong and i can't open files...

if restic works that is not a problem, i keep this note for future...

thank you again

rawtaz commented 2 years ago

Yes, restic keeps the original directory structure when restoring the files. This should not be a problem - you just simply move the relevant parts of the restored dirs/files to where you want them and then delete the remainder that you aren't interested in.

As I suggested earlier, read the help text for the dump command, and you'll probably see why you can't open the file that was dumped.

EDIT: Please also close this issue once you solved your problem, thanks!