User Profile

Collapse

Profile Sidebar

Collapse
Apros
Apros
Last Activity: Nov 12 '09, 06:13 PM
Joined: Nov 11 '09
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Apros
    replied to Wildcard Strings in Path
    :D
    Thank you, so much!
    It worked!
    *bows to the epic superiority of bvdet*

    Now, if you want to delete the folder, it would be

    path = os.getcwd()
    os.rmdir(path)

    correct, no?
    See more | Go to post

    Leave a comment:


  • Apros
    replied to Wildcard Strings in Path
    Grr...
    Okay, this is the script I have so far...

    Code:
    import os
    curDir = os.listdir(os.getcwd())
    for fn in fileList: 
        os.remove(os.path.join(curDir, fn)
    I'm going to guess that I'm doing it completely wrong...
    So... the listdir is supposed to list the files that are in the current directory
    Then for the filename in the list, remove ((Current DIrectory)+File name)
    ...
    See more | Go to post
    Last edited by bvdet; Nov 12 '09, 02:32 AM. Reason: Add code tags

    Leave a comment:


  • Apros
    replied to Wildcard Strings in Path
    If I do the first, I end up with:

    Traceback (most recent call last):
    File "<pyshell#1 9>", line 1, in <module>
    os.remove(os.li stdir(os.getcwd ()))
    TypeError: remove() argument 1 must be string, not list

    So how do I make all of the list, which can vary thus needing of a wildcard, into strings? I'm sorry, but I just picked up programming a little while ago, and Python just...
    See more | Go to post

    Leave a comment:


  • Apros
    started a topic Wildcard Strings in Path

    Wildcard Strings in Path

    Okay, this is what I need to do, and I keep getting confused.
    I need to remove all files in a folder, then delete the folder, it's part of an installer I'm making, and it creates a directory, I just don't know how to delete it. This is what I have right now:
    curDir = os.getcwd()
    os.remove(os.pa th.join(curDir, *)
    So it will remove all the files in the directory it is in. How do I use the wildcard to make it all files in...
    See more | Go to post
No activity results to display
Show More
Working...