I want to make sure that I delete required files. I have code something like
dir="/some/path/"
file = "somefile.txt"
cmd_rm= "rm -rf "+dir + file
os.system(cmd_rm)
The dir
and file
values are fetched from a database. How can I make sure I never end up running rm -rf /
?
What things should I check before doing rm -rf
?