I have a share -// which has many files in it.

Which is the best way to delete all the files in this directory using python?

I tried:

import os 
folder = '\\\myshare1'

for the_file in os.listdir(folder):
    file_path = os.path.join(folder, the_file)
        if os.path.isfile(file_path):
    except Exception, e:
        print e

Here, I'm having a hiccup with the slashes

for the_file in os.listdir(folder):
OSError: [Errno 2] No such file or directory: '\\\\myshare1'

Thanks in advance

you have to do

folder = r'\\\myshare1'
# OR
folder = '\\\\\\myshare1'