-
Notifications
You must be signed in to change notification settings - Fork 0
Home
The idea to create Recycler came out of the realization that my Download folder tends to accumulate with an ever growing number of files and 99% of the times they are totally useless. You can of course just delete the Download folder yourself manually periodically, but I thought this would give a nice project to develop using test-driven development (TDD).
Recyler monitors previously selected folders and deletes files that go over a specified 'age'.
The concept of 'age' is not related to the date of the file itself, but it means the time interval since a file was first detected by Recycler and the time that has passed so far.
As of the moment it is developed in C# using Visual Studio but the end goal is to become multi-platform (supporting Linux and MS Windows).
- Monitors folders, looking both for new and existent files
- Monitors age of files to determine when to recycle them
- File is new once detected and will age until is time to recycle it
- Concept of 'age' is not dependent of file time stamp
- Age is determined for the first moment a new file is detected and increases every new X hours (typically X = 24)
- Age depends then on local time (issue: changing a date causes recycling?)
- do recycle action once is file is old:
- delete (recycle bin)
- move to folder
- Determined for the first moment a new file is detected and increases every new X hours (typically X = 24)
- Not dependent of file time stamp
Operation is managed by 3 components
Detects file system changes (new and removed files).
-
Detects file changes at a list of known folders. Creates a representation object for the change (a new file detected, or a deletion of an existent file). Publishes that change.
-
Change is published to FileDescriptorUpdater which:
If the file change is 'new file' -> create a FileDescriptor and stores at the FileDescriptorIndexer
If the file change is 'deleted file' -> remove its FileDescriptor from the FileDescriptorIndexer
Auxiliary classes
- FileDescriptorUpdater - Updates the indexer with the change (new file: insert to index, delete file: remove from index) - see FileDescriptorIndexer.
- FileDescriptorIndexer - Keeps an index with the current monitored files information, including file 'age'. Examples of indexers: The plain text indexer, the database indexer.
In principle known folders are not recursive. But if decided otherwise, known folder A cannot be inside of a known folder B.
Periodically enumerates all indexed files and calculates each file 'age'.
For files with 'age' older than recycling period, can execute an action. Actions can be: Delete, move to folder, execute(?)