/rm-rt

A tool to avoid deleting files or directories with commands rm by mistake,and set a self-cleaning recycling station in linux system or others.

Primary LanguageShellGNU General Public License v3.0GPL-3.0


rm-rt

A tool to avoid deleting files or directories with command rm by mistake.

Set a self-cleaning recycling station in linux system or others.


1. Introduction

 1.1 It is designed to replace old command rm without having to delete it.

 1.2 It can avoid deleting files or directories with old command rm by mistake.

 1.3 You can continue to use new 'rm' to delete files or directories, and it will move the target file or directory to

  a trash directory instead of directly deleting them.

 1.4 Besides, you can set the time to automatically empty the trash directory.

2. Installation

 2.2 you can simply run sh install.sh to install rt:

  cd rm-rt-master
  sh install.sh     or    sh install.for_China.sh

  Then, you can set the trash folder and Software bin folder:

  Enter Your trash folder: ***
  Enter Your Software bin folder: ***

  Next, the installation is running:

  Your trash folder is ***
  Your Software bin folder is ***
  
  Good jobs! 
  Installation of rm-rt is finished!

  You also can manually install rm-rt by 2.3-2.6;

 2.3 cp rm-rt/rt to your directory;

 2.4 vim rt, set your trash directory and your global path of rt, the default is ~/zwg.trash;

 2.5 echo 'alias rm="your-directory/rt"' >> ~/.bashrc ; source ~/.bashrc;

 2.6 crontab -e , write '0 0 * * 0 rm -rf /your-trash-directory/*';

3. Usage

 You can use the 'rm' or 'rt' command to do the following.

 3.1 Delete files or directories, and you can recover them if you continue to need.

touch test.file ; mkdir test.directory
rm    test.file  test.directory 
Finished: have moved the target file or directory to '$trash directory'

 3.2 You can recover target file or directory when you need.

rm rec  test.file  test.directory
Finished: have recover the target file or directory from '$trash directory'
 3.3 Permanently delete files or directories
touch test.file ; mkdir test.directory
rm del    test.file  test.directory
Are you sure to permanently delete files or directories? Y/N
   If you input Y or yes, the test.file and test.directory are permanently deleted
Warning: have permanently deleted the target file or directory
   If you input N or no, the test.file and test.directory are be moved to trash directory.
Finished: have moved the target file or directory to '$trash directory'

4. Thanks

 Thanks to Prof. Fan, Prof. Liu and others for their teaching knowledge of programming.

 Thanks to the network for providing many learning resources.

5. Getting Help

 Please use the GitHub's Issues page if you have questions. You may also directly contact WeigangZheng at zwg2016@yeah.net

 Date: 2020-04-05