Skip to content

Using rm protection in Python

Alan Chan edited this page Feb 5, 2017 · 1 revision

rm-protection logo

rm-protection is written to be reusable.

Currently it provides two modules: rm_p and protect.

rm_p.rm()

rm_p.rm() is the rm-p equivlent in command line. Unlike in the command line, you need to feed it with a list of arguments.

protect.protect()

rm_p.rm() is the protect equivlent in the command line. It takes a list of file names.

Example

from rm_protection.rm_p import rm
from rm_protection.protect import protect
rm(['-rf', 'file1', 'file2', 'dir1'])
protect(['foo', 'bar'])

Clone this wiki locally