Project 12
Automated folder cleanup
This Windows Forms application automates routine file maintenance by identifying and archiving files that exceed a user-configurable age threshold. The tool provides an intuitive graphical interface for managing directory cleanup operations while reinforcing safe file system interaction and comprehensive error handling patterns.
C# (.NET)
System.IO
Windows Forms (GUI)
Technical
Highlights
Traversed directory contents using
Directory.GetFiles()andSearchOption.AllDirectoriesenumerate files programmatically across nested folder structures.Evaluated file age using metadata such as
LastWriteTimeandCreationTimeto determine which files meet the archival criteria.Implemented conditional logic to move files to an archive location based on age rules, with intelligent handling of duplicate filenames to prevent data loss.
Logged all actions and exceptions using the reusable
SimpleLoggerclass for traceability and audit trails.Designed an interactive Windows Forms UI with real-time console output, configurable
dateTimePickercontrol, and summary statistics upon completion.Automatically identifies and removes empty directories after archiving files to maintain clean folder structures.
Project
Takeaways
Gained experience automating repetitive system maintenance tasks through a user-friendly graphical interface.
Learned how to safely manipulate the file system from C# with proper validation and error handling.
Developed strategies for handling real-world error scenarios such as locked files and permission restrictions using specific exception types (
UnauthorizedAccessException,IOException).Implemented thread-safe UI updates using
Invokefor cross-thread communication in Windows Forms applications.