To Home Page

IT 212 -- Project 6

Project 6: Photo Albums

Goal:

Relevant Examples:

Details:

Pseudocode

  • Here is pseudocode that you can use:
    Import os and shutil modules.
    
    Assign previous_album to the empty string ("").
    Open index file, call the file object fin.
    Read first line of input file.
    While input file not empty,
        Use split to obtain fields.
        Assign zeroth field to folder_name.
        Assign first field to original_photo_name 
        If previous_album != folder_name
            Use os.mkdir to create new folder named folder_name.
            Initialize counter to 1.
            Assign folder_name to previous_album
        End.
    
        # Next two lines are literal Python statements.
        new_photo_name = "{:s}/{:03d}-{:s}". \
            format(folder_name, counter, original_photo_name)
        Use shutil.copy method to copy "originals/" + original_photo_name
            to new_photo_name.
        Add one to counter.
        Read next line of input file.
    End.