# rm-rt **Repository Path**: Velcon-Zheng/rm-rt ## Basic Information - **Project Name**: rm-rt - **Description**: 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 Language**: Shell - **License**: GPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-05-25 - **Last Updated**: 2025-11-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README --- # 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](http://man7.org/linux/man-pages/man1/rm.1.html) 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.1 git clone https://github.com/Velcon-Zheng/rm-rt.git ####  2.2 you can simply run sh install.sh to install rt: ```sh cd rm-rt-master sh install.sh or sh install.for_China.sh ``` ####   Then, you can set the trash folder and Software bin folder: ```sh Enter Your trash folder: *** Enter Your Software bin folder: *** ``` ####   Next, the installation is running: ```sh 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](https://www.rosehosting.com/blog/linux-crontab/) -e , write '0 0 * * 0 rm -rf /your-trash-directory/*'; ####   [This is optional and you can set the time to automatically empty your-trash-directory.](https://www.rosehosting.com/blog/linux-crontab/) # ## 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. ```sh 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. ```sh rm rec test.file test.directory Finished: have recover the target file or directory from '$trash directory' ``` ##### #####  3.3 Permanently delete files or directories ```sh 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 ```sh 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. ```sh 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