File Organizer

Base on a project in 5 Great Python Project Ideas (YouTube)

The tale

You have many directories containing many files and files types. It is a mess and needs to be organized in some manner.

Project #1

Assume you have single directory containing many files and file types.

Create a test directory for this project. Copy many files and file types to the test directory.

Write a program to organize the files in the test directory.

Create subdirectories as needed. (i.e. Create a subdirectory only when there is a file to go in it.)

This organizes each file by file type.

Project #2

Assume you have many directories containing many files and file types. Create a test directory tree for this project.

  1. create a root directory for the test tree
  2. create subdirectories (perhaps one subdirectory for each project? Or one for each category: utilities, servers, ...?)
  3. copy many files and file types to the test tree
  4. the same file name can be in multiple directories (i.e. "config.txt")

Write a program to organize the files in the test tree.

This organizes each file type under each project, utility, ...

Create subdirectories as needed. (i.e. Create a subdirectory only when there is a file to go in it.)

Are sub subdirectories needed? They may be needed depending on your file sources and the organized tree structure you want. (e.g. different file versions?)

Project #3

Write a program to organize the files in the Project #2 test tree.

  1. create a root directory for the organized-files-tree
  2. under the organized-file-tree root, create a subdirectory for each file type
  3. under each file type directory, create a subdirectory for each project, utility, ...
  4. move files to the appropriate subdirectories
  5. display
    1. each directory/subdirectory name
    2. the number of files in each directory

Create subdirectories as needed. (i.e. Create a subdirectory only when there is a file to go in it.)

This organizes each "project" under each file type.

Project #4

How would you organize file differently? Test your method of organizing.