[PYTHON] Don't use rm command to delete files

rm -rf *

If you make a mistake after doing it, your stomach will hurt ... I decided to use trash-cli.

Installation

I wanted to use easy_install ... but what's on PyPI is It's quite old. Try to use the master one.

> git clone https://github.com/andreafrancia/trash-cli.git
> sudo python setup.py install

Operation check

Let's check the operation. Create a test file for deletion.

> mkdir -p ~/Hoge
> touch ~/Hoge/uge
> ls ~/Hoge
uge

Delete the uge file. Now run the trash-put command.

> trash-put ~/Hoge/uge

Confirm that uge has disappeared

> ls ~/Hoge

Use the trash-list command to check if it appears in the deleted file list.

> trash-list
2013-10-22 18:09:11 /Users/futoase/Hoge/uge

It came out. Try to restore.

> trash-restore                                                 
   0 2013-10-22 18:09:11 /Users/futoase/Hoge/uge
What file to restore [0..0]: 0
> ls ~/Hoge
uge

Permanently delete files

trash-emptyWith a commandtrash-popCompletely delete the file.

other

[Crush according to README.md](https://github.com/andreafrancia/trash-cli#but-sometimes-i-forgot-to-use-trash] in trash-cli to prevent rm from being used -put-really-cant-i).

I want to live in peace ...

Recommended Posts

Don't use rm command to delete files
[systemd] Command to delete service
How to use MBDyn (command setting)
Use Flask to run external files
[python] How to use __command__, function explanation
[Linux] How to use the echo command
How to use the Linux grep command
Use boto to upload / download files to s3.
3 best ways to use the less command
Use shutil to delete all folders with a small number of files
Create a command to delete all temporary files generated in a specific folder
Add a command to mark similar files together
Use click to create a sub-sub command --netsted sub-sub command -
I don't want to use -inf with np.log
How to use the grep command to recursively search directories and files to a specified depth
[For beginners] How to use say command in python!
How to delete the specified string with the sed command! !! !!
I investigated what permissions I needed to delete linux files.
Linux user addition, how to use the useradd command
How to use the grep command and frequent samples
How to use variables in systemd Unit definition files
(Remember quickly) How to use the LINUX command line
How to use xml.etree.ElementTree
How to use virtualenv
How to use Seaboan
How to use image-match
How to use shogun
How to use Pandas 2
How to use Virtualenv
How to use numpy.vectorize
If you don't know it, it's dangerous. Carefully explain how to use the xargs command
How to use pytest_report_header
Easy to use Flask
How to use partial
How to use SymPy
How to use x-means
How to use WikiExtractor.py
How to use IPython
How to use virtualenv
How to use Matplotlib
How to use iptables
How to use numpy
How to use TokyoTechFes2015
How to use venv
How to use dictionary {}
How to use Pyenv
Easy to use SQLite3
How to use list []
How to use python-kabusapi
Python-How to use pyinstaller
How to use OptParse
How to use return
How to use dotenv
How to use pyenv-virtualenv
How to use Go.mod
How to use imutils
How to use import
[Command] Command to get a list of files containing double-byte characters
Add Linux user, how to use useradd command (password specification)
"Chmod" command to set permissions and access permissions for files and folders
[Python] Use this to read and write wav files [wavio]