Skip to content

Coelor/directory-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Directory Manager

A file system data structure implementation developed for CSCI 4100 - Introduction to Algorithms. This project demonstrates practical application of fundamental algorithms and data structures including tree traversals, hash-based indexing, and graph search algorithms.

Features

  • File System Simulation: Hierarchical directory structure with files and folders
  • Multiple Search Methods: Find files by name, extension, wildcard patterns, or metadata
  • Efficient Indexing: Hash-based indexing for O(1) file lookups by name and type
  • Path Finding: BFS implementation to find shortest path to any file
  • Duplicate Detection: Identify duplicate files based on name and size
  • Directory Traversal: DFS-based directory structure visualization
  • Performance Measurement: Built-in timing for algorithm performance analysis

Algorithms Implemented

  • Breadth-First Search (BFS): Shortest path finding
  • Depth-First Search (DFS): Directory tree traversal
  • Hash Table Indexing: O(1) file lookups
  • Pattern Matching: Wildcard search using fnmatch
  • Tree Data Structure: Hierarchical file system representation

Project Structure

directory-manager/
├── main.py          # Example usage and demonstrations
├── filesystem.py    # FileSystem class with search algorithms
├── fsnode.py        # FSNode class representing files/directories
├── utils.py         # Utility functions for timing and output
└── README.md        # Project documentation

Usage

Run the demonstration:

python main.py

The program will demonstrate:

  • Adding files to the directory structure
  • Finding files by exact name
  • Searching by file extension
  • Wildcard pattern matching
  • Calculating directory sizes
  • Finding shortest paths to files
  • Detecting duplicate files
  • Displaying directory structure

Example Output

Finding files by name 'file1.txt':
Time taken: 0.0123 ms
Results:
  - Root/dir1/subdir1/file1.txt
  - Root/dir1/subdir2/file1.txt

Finding shortest path to 'file3.jpg':
('Root/dir2/file3.jpg', 2)

Directory structure:
Root (Dir, Size: 2350 KB)
  dir1 (Dir, Size: 525 KB)
    subdir1 (Dir, Size: 475 KB)
      file1.txt (File, Size: 100 KB)
      file6.txt (File, Size: 75 KB)
      subdir1-1 (Dir, Size: 300 KB)
        file3.jpg (File, Size: 300 KB)

Time Complexity

  • File Search by Name: O(1) average case using hash indexing
  • Extension Search: O(1) to find file type, O(k) to return k results
  • Wildcard Search: O(n) where n is total number of unique filenames
  • Shortest Path: O(V + E) using BFS where V is nodes, E is edges
  • Directory Size: O(n) where n is files in subtree
  • Duplicate Detection: O(n) where n is total files

Requirements

  • Python 3.x
  • Standard library only (no external dependencies)

Academic Context

This project was developed as a final assignment for CSCI 4100 - Introduction to Algorithms, demonstrating practical implementation of core algorithmic concepts in a real-world scenario of file system management.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages