dirpath is just a string, so there's no sense in putting it in a list
and then iterating over that list.
If you're trying to do something with each file in the tree:
for dir, subdirs, names in os.walk(rootdir):
for name in names:
filepath = os.path.join(dir, name) + "-dummy"
i
Fulvio wrote:
> Alle 18:18, giovedì 06 aprile 2006, [EMAIL PROTECTED] ha scritto:
>> How can i deal with spaces in this case?
> I don't have an idea with python, but if can help I may say that bash you
> might use "\ " to escape a space or use a quoted full path.
> The shell program "basename" is
Alle 18:18, giovedì 06 aprile 2006, [EMAIL PROTECTED] ha scritto:
> How can i deal with spaces in this case?
I don't have an idea with python, but if can help I may say that bash you
might use "\ " to escape a space or use a quoted full path.
The shell program "basename" is failing, anyhow with fi
> try
>
> filename = dirpath + "-dummy"
> if not os.path.isfile(filename):
> open(filename, "w").close()
better make that
basename = os.path.basename(dirpath) + "-dummy"
filename = os.path.join(dirpath, basename)
if not os.path.isfile(filename):
open(filename,
[EMAIL PROTECTED] wrote:
> I wanted to touch a file with the same name as the directories inside
> each directory
>
> rootdir
>| > ABC DEF A
> |---> ABC DEF A-dummy
>| ---> BDD SD N
> |---> BDD SD N-dummy
>
> heres the code :
> for d in os.wa