create folder

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • exfel
    New Member
    • Jan 2007
    • 4

    create folder

    i want to make a back up file of one of my folder. is there any software which will create a new folder on a daily basis every time my i open my computer and copies the files from my folder as a backup...

    thanks.... sorry for my english.. wink
  • mg0959
    New Member
    • Dec 2007
    • 5

    #2
    I don't know if I can be of help but here is some code that should open a file, read it, and copy it to a new directory.

    ###
    import os

    # open file to be copied
    filename = open(path, "rb") # path is the place where file is located given as a string
    # "rb" read it as binary as not to corrupt the file

    info = filename.read() # reads the file to variable "info"

    filename.close( ) # closes the file after it has been read

    os.mkdir(folder _path) # makes a new folder/directory for the file to be put where
    # folder path is the path for the new folder

    # make new file
    new_filename = open(new_file_p ath, "wb") # new_file_path is the location and name of where the new file will be made
    # given as a string
    #(don't forget to add extension such as ".txt")
    # "wb" writes it as binary as not to currupt the file


    new_filename.wr ite(info) # writes info to new file

    new_filename.cl ose() # this closes the file

    print "done"
    ###

    Comment

    Working...