Thread: Quick Tip?

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2004
    Posts
    3
    Rep Power
    0

    Quick Tip?


    My brain seems to not be working today, so I thought I would ask for a little help. I have this program that searches for folders with certain names, but a problem occured when it found an xls document with the same name as the folders it was looking for. I realize I could just rename the xls document, but I would rather have the code omit files. Is there a way to do this, or have it so it only looks at folders and not files?
  2. #2
  3. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    14
    There are functions in the os module to help make those decisions. That assumes it is Python you are talking about.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2004
    Posts
    3
    Rep Power
    0
    Originally Posted by Grim Archon
    There are functions in the os module to help make those decisions. That assumes it is Python you are talking about.
    Yes, it is Python. Sorry I didnt mention (remember brain not working comment? haha) I am a pure newbie so, I'm trying to figure out what you mean by "in the os module"...
  6. #4
  7. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    The functions i think Grim was getting at is called os.path.isdir() which you can find in the os.path documentation - along with some others which you can also use to check if the path is this or that.

    Just because your brain isn't working today here it is .

    http://www.python.org/doc/2.3.4/lib/module-os.path.html

    Hope this helps,

    Mark.
    programming language development: www.netytan.com Hula

  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2004
    Posts
    3
    Rep Power
    0
    Thanks alot guys, it works!
  10. #6
  11. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    No problem at all. You might also want to take a few seconds to look over the stick at the top of this forum conserning how to ask a question .

    Mark.
    programming language development: www.netytan.com Hula


IMN logo majestic logo threadwatch logo seochat tools logo