I've looked at a few posts regarding this topic but haven't seen anything specifically fitting my usage. This one looks to be close to the same issue. They talk about escaping the escape characters.
My issue is that I want this script to run on both MAC and PC systems - and to be able to process files in a sub-folder that has spaces in the folder name.
Right now I use this code gleaned partially from several different SO posts:
directory = raw_input("Enter the location of the files: ")
path = r"%s" % directory
for file in os.listdir(path):
I don't quite understand what the second line is doing - so perhaps that's the obvious line that needs tweaking. It works fine with regular folder names but not with spaces in the name.
I have tried using "\ " instead of just " ", - that didn't work - but in any case I'm looking for a code solution. I don't want the user to have to specify an escape character
On Windoze using sub folder name "LAS Data" in response to raw_input prompt (without quotation marks), I get an message that:
the system can't find the path specified "LAS Data\*.*"