Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Delete file via Python

#!/usr/bin/python
import os
myfile="/tmp/foo.txt"

## If file exists, delete it ##
if os.path.isfile(myfile):
    os.remove(myfile)
else:    ## Show an error ##
    print("Error: %s file not found" % myfile)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Delete #file #Python
ADD COMMENT
Topic
Name
1+7 =