Coder Social home page Coder Social logo

safe_rm's Introduction

Safe-Remove/Restore Project

  • Create a recycle bin at $HOME/deleted (default).
  • Recycle bin location can be customized by using $HOME/.rm.cfg or env variable $RMCFG.
  • To avoid name conflicts in the recycle bin, the file name is changed to the original name followed by an underscore and then followed by the inode. * For example, if a file named "f1" with inode 1234 were removed, the file would be named f1_1234 in the recycle bin.
  • Original directory and filename are stored in $HOME/.restore.info * Each line of this file contain the name of a stored file, followed by a colon, followed by the original full path and filename. * For example, if file f1 with inode 1234 were removed from the /home/usr1.name/ directory and another file named f1 with inode 5432 were removed from the /home/usr1.name/testing directory then .restore.info would contain:
    • f1_1234:/home/usr1.name/f1
    • f1_5432:/home/usr1.name/testing/f1
  • To restore a file use safe_rm_restore * For example: safe_rm_restore f1_1234
  • Error checking
    • Use "safe_rm" without a name of a file - error message
    • Use "safe_rm file1" and file1 does not exist - error message
    • Use "safe_rm dir1" and dir1 is a directory - error message
    • Try to restore a file that does not exist in the recycle bin - error message
    • If the restoring file already exists in the target directory, it will prompt "Do you want to overwrite?"
  • safe_rm supports wildcards and option flags: -i for interactive, and -v for verbose, -r or -R to remove file(s) and directories recursively. * Example:
    • safe_rm file1 file2 file3
    • safe_rm *
    • safe_rm -ivr *

safe_rm's People

Contributors

sdudakiya avatar

Watchers

James Cloos 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.