I have a share -//192.168.0.11/myshare which has many files in it.
Which is the best way to delete all the files in this directory using python?
I tried:
Here, I'm having a hiccup with the slashes
Thanks in advance
Which is the best way to delete all the files in this directory using python?
I tried:
Code:
import os
folder = '\\192.168.0.12\myshare1'
for the_file in os.listdir(folder):
file_path = os.path.join(folder, the_file)
try:
if os.path.isfile(file_path):
os.unlink(file_path)
except Exception, e:
print e
for the_file in os.listdir(folder):
OSError: [Errno 2] No such file or directory: '\\192.168.0.12\\myshare1'
Thanks in advance