Skip to main content

Spring cleans a file directory by storing away its old subdirectories.

Project description

Black and white picture of stacks of old folders

Old Folder spring cleans a file directory by storing away subdirectories that haven’t been modified for a given period.

Usage

Python 3.6+ must be preinstalled.

Old Folder can then be pip installed from PyPI and used via a command line interface:

F:\>oldfolder -h
usage: oldfolder [-h] [-t {modified,accessed,created}] path number storage

Move old subdirectories that contain files which haven't been modified for
a given period of time.
Moves can also be specified based on created or accessed time.

positional arguments:
 path                  Path of directory where subdirectories can be found.
 number                Number of years since files in subdirectories were
                       modified, accessed, or created.
 storage               Name of storage folder to place the old
                       subdirectories inside. The storage folder
                       location will be the specifed path.

optional arguments:
 -h, --help            show this help message and exit
 -t {modified,accessed,created}, --time_type {modified,accessed,created}
                       Time stat type to base the move on.

Or you can run it directly:

F:\>py oldfolder.py -h

Pass the path of the main directory, the length of time and the storage folder name to the program:

F:\>oldfolder "F:\main_directory" 1.5 "old_stuff"

Subdirectories that don’t contain any files modified during the period will be listed for storage:

Based on the modified times of the files contained within them,
the subdirectories that will be moved to the old_stuff folder are:
         old_files_1
         old_files_2
Would you like to proceed?: Y/N

Before

F:\main_directory>tree /F
...
F:.
├───new_files_1
│   │   new_file.jpg
│   │
│   ├───second_level_folder_1
│   │       really_new_file.txt
│   │
│   └───second_level_folder_2
│           very_new_file.txt
│
├───new_files_2
│       fairly_new_file.txt
│
├───old_files_1
│   │   old_file.txt
│   │
│   └───second_level_folder_1
│       │   old_file_as_well.txt
│       │
│       └───third_level_folder
│               really_old_file.jpg
│
└───old_files_2
    │   another_old_file.txt
    │
    └───old_second_level_folder
            oldest_file.jpg
            old_file_2.txt

After

F:\main_directory>tree /F
...
F:.
 ├───new_files_1
 │   │   new_file.jpg
 │   │
 │   ├───second_level_folder_1
 │   │       really_new_file.txt
 │   │
 │   └───second_level_folder_2
 │           very_new_file.txt
 │
 ├───new_files_2
 │       fairly_new_file.txt
 │
 └───old_stuff
     ├───old_files_1
     │   │   old_file.txt
     │   │
     │   └───second_level_folder_1
     │       │   old_file_as_well.txt
     │       │
     │       └───third_level_folder
     │               really_old_file.jpg
     │
     └───old_files_2
         │   another_old_file.txt
         │
         └───old_second_level_folder
                 oldest_file.jpg
                 old_file_2.txt

You can read more about the program towards the end of this shutil article.

Importing

You can also use Old Folder’s functions in your own projects:

import oldfolder


file_operations = oldfolder.prepare_move("F:\main_directory" 1.5 "old_stuff")

oldfolder.move_files(file_operations)

License

Old Folder is offered under the BSD 3 Clause license.

Protecting Your Data

As with other utilities that employ Python’s shutil module to carry out high-level file operations, proceeding with caution and creating a backup of your data prior to use is strongly recommended.

Operating System

Old Folder is intended to be operating system independent, but has so far only been tested on Windows.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oldfolder-0.1.1.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oldfolder-0.1.1-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file oldfolder-0.1.1.tar.gz.

File metadata

  • Download URL: oldfolder-0.1.1.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.2

File hashes

Hashes for oldfolder-0.1.1.tar.gz
Algorithm Hash digest
SHA256 99285e06d8b80237b140cabbc098e82a5a0138ec09cf632ce4abb06ef8138422
MD5 1941fae71e6d853cfae996fd6fd6f1f8
BLAKE2b-256 aa338a33786f35ed3e962ebca6c6dcac249a4ab3ff99acb65af0e74e12e58372

See more details on using hashes here.

File details

Details for the file oldfolder-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: oldfolder-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.2

File hashes

Hashes for oldfolder-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 95fa9d5b9eadfdc87515f733c1c9e34b72b35241ea170bd0af9e80c3c0dc790c
MD5 a47a90b59d4fe06f695ef2c4815df497
BLAKE2b-256 78d8413fb9cc31d0e92ec432d5413d0cfd3639dfd12beee278d6f59424648215

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page