0

hello all,
I have a program, and in it, it eventually specifies 'aFolder' to be os.walk(path/to/folder) how do I obtain inifo such as the name or the path of the folder, is it then the temporary current working directory?

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by snippsat
0

Show what you trying to do, we need more information about what error you are getting with what data and by what code you trying to accomplish and what you want to accomplish.

1

how do I obtain inifo such as the name or the path of the folder,

Maybe i dont understand you,if you give the path to the folder.
Then you can store it in a variable and just print it out.

import os

aFolder = 'C:/test/'
print 'Top folder is %s' % aFolder
for root, dirs, files in os.walk(aFolder):
    for sub in dirs:
        print sub #Will print all subfolder in C:\test\

You have os.getcwd()
Return a string representing of the current working directory.

If unclear as @tony postet give more info.

Edited by snippsat: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.