Skip to main content

A cross-platform module for sorting files by time.

Project description

mtsort

A cross-platform module for sorting files by time.

PyPI version GitHub license

Gets last modification time from file(s) and folder(s), then moves them to a new directory, sorting them in new folders. These folder names are in 'yyyy-mm-dd' format.

Useful for sorting large collections of files, which would be otherwise tedious to do manually!

Tested and confirmed working on Python 3.6 and above.

Installation

pip install mtsort

or with the installation script:

python3 setup.py install

Examples

Moving files:

>>> import mtsort
>>> mtsort.mtmove('/home/test/sourcedir', '/home/test/destdir')

Results in:

    before:                after:
    .                      .
    |-- destdir            |-- destdir
    |-- sourcedir          |   |-- 2016-07-29  
        |-- file1          |   |   |-- file1
        |-- file2          |   |-- 2016-07-30
        |-- file3          |   |   |-- file2
                           |   |-- 2016-07-31
                           |       |-- file3
                           |-- sourcedir

Copying files:

>>> import mtsort
>>> mtsort.mtcopy('/home/test/sourcedir', '/home/test/destdir')

Results in:

    before:                after:
    .                      .
    |-- destdir            |-- destdir
    |-- sourcedir          |   |-- 2016-07-29  
        |-- file1          |   |   |-- file1
        |-- file2          |   |-- 2016-07-30
        |-- file3          |   |   |-- file2
                           |   |-- 2016-07-31
                           |       |-- file3
                           |-- sourcedir
                               |-- file1
                               |-- file2
                               |-- file3

Alternatively, you can simply launch the script on its own, or from the command line to use it:

from terminal:

$ mtsort

from cmd or Powershell:

C:\> py -m mtsort

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

mtsort-1.0.1.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

mtsort-1.0.1-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file mtsort-1.0.1.tar.gz.

File metadata

  • Download URL: mtsort-1.0.1.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.4.8

File hashes

Hashes for mtsort-1.0.1.tar.gz
Algorithm Hash digest
SHA256 269e265cfb2eec60b246cf3bdfb595ed16fd0880fed2f4d72d7f3c472ff448c5
MD5 d492177732cf12cde959623b9c550959
BLAKE2b-256 6020decad78b6ca2a504ec3a49524e3db47263ccf2bf667d1eca08ea5fd7d59a

See more details on using hashes here.

File details

Details for the file mtsort-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: mtsort-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.4.8

File hashes

Hashes for mtsort-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 31300df38b578c234a6137f033ae855bbac2bf3f34994f71cbca63cc4790b0f8
MD5 c250b80b610b60bcef07683794510313
BLAKE2b-256 5ced22c5fda93669e918e8b079d17cf35c4c9afeb00ba92e4aaba156cd0e1346

See more details on using hashes here.

Supported by

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