Giter Club home page Giter Club logo

salvagefile's Introduction

Salvage File

A utility for copying as much of a file as possible.

Usage

Usage: SalvageFile (action)
 Common Options:
 -h / --help       Print this help

 (s)alvage (source) (destination)
 Copies as much of a file as possible.
  Options:
  -b (number)       Size of byte buffer in bytes (default: 4096). Larger values can be used to speed up the copy proces
   s but at reduced accuracy
  -v                Print more information including % complete
  -q                Print errors only and suppress copy warning messages

 (d)iff (file one) (file two)
 Compares the blocks of each file and shows if they are different
  Options:
  -b (number)       Size blocks in bytes (default: 4096)
  -v                Show all block hashes
  -q                Only show blocks that differ

Notes

  • This program tries to copy all the chunks of a file. Any chunks that fail are replaced with zeros.
  • I've seen that sometimes using a smaller buffer (-b) results in worse recovery, so you may need to play with the setting to achieve best results.
  • As far as I can tell there's no way to control the read timeout without using system-dependent calls (which i'm avoiding)
  • This program uses the regular System.IO.File class to read / write files
  • The source and destination file systems must support seeking (most do).

Build

  • Install dotnet. see Get started
  • Build with dotnet build -p src

Native Build

Linux

  1. Install dotnet on linux
  2. run ./make.sh publish

Windows

  • Using Visual Studio
    1. Launch the "x64 Native Tools Command Prompt for VS" command prompt
    2. Use msys bash to execute ./make.sh publish
  • I've also had success using cmder which comes with bash
  • Installing dotnet on WSL is rummored to work as well

Mac Os-X

TODO

  • Test source and destination filesystem for seek support (currently just throws an exception)
  • Check if destination file already exists and prompt for overwrite
  • Consider implementing a sequential read option to allow reading non-seekable filesystems
  • Add a way to diff copies of a recovered file and see which chunks are different
    • maybe show % amount of 0's in the chunk
  • Maybe make a chunk 'merge' tool where you select which chunks to keep from each file
  • output which chunks were replaced with 0's

salvagefile's People

Contributors

rasberry avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.