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.0.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.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: oldfolder-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 1bee2cf0bd463a5d635bfbeef441ff520b9e5f7376f147905c99af2badfed8ba
MD5 d6bd000cd41b399339798f5011e08329
BLAKE2b-256 faa77c727ba076274f177b7aab97887b71b8a574d8191f97e5ea39b3204cc81c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: oldfolder-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5ceff7870f930ec62baae3f18c36f48c1f45927d3f23ae3ba52984863f3a57ff
MD5 e3450b6e2627a67ff3a47bea61f71d85
BLAKE2b-256 b5750007ea28755b41d1e2c276835ab0e611696910a3770a3334444097ccda2b

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