Skip to main content

Python-based command-line tool that organizes and sorts files by their extension types

Project description

yasfs - Yet Another Simple File Sorter

Version: 1.0
Description: yasfs is a Python-based command-line tool that organizes and sorts files by their extension types.

Installation

You can install this repo directly from PyPI using pip:

pip install yasfs

Or, you can install directly from this repository:

pip install git+https://github.com/ashaider/yet-another-simple-file-sorter.git

Usage

To get help with commandline arguments

yasfs --help

Basic Usage

yasfs -s /path/to/source -d /path/to/destination

Optional Arguments

  • --source or -s: The path to the directory where the files will be read from
  • --destination or -d: The path to the directory where the files will be moved to and sorted at
  • --subfolder_only_sort or -sf: When provided, does not sort files if they have no pre-made destination folder All of the above optional arguments, if not provided, will pull their value from config.ini.
  • --use_current_dir or -u: When provided, overrides source and destination with the current directory in the commandline. (Using -s and -d alongside this will render their values useless)
  • --config or -c: Opens the config file and exits

Configuration

By default, yasfs looks for a configuration file named config.ini located in the parent directory of the script. The settings in this file can be overrriden through the use of optional arguments in the command line. However,the config file also specifies custom sorting rules, allowing you to map specific file types to custom subfolders, which cannot be done from the command line.

The following is an example of how a config.ini file could look like:

[Settings]
source: /path/to/source
destination: /path/to/destination
sort_only_if_destination_subfolder_exists: False

[Overwrite Destinations]
Audio_Files: MP3, WAV, OGG, M4A, FLAC, AIFF, WMA, AAC
Image_Files: PNG, JPG, JPEG, HEIF, WEBP, TIF, TIFF, BMP, GIF, EPS
Text_Files: DOCX, PDF, PPT, PPTX, XLS, XLSX, XML, ODT, TXT, RTF, CSV, DOC, WPS, WPD, MSG. JSON, INI, LOG, YML, YAML, CONF
Video_Files: MP4, MPG, MOV, AVI, WMV, AVCHD, WEBM, FLV, F4V, SWF, MKV, WEBM, 3GP
Executable_Files: EXE, BAT, COM, CMD, INF, IPA, OSX, PIF, RUN, WSH, SH
Code_Files: C, CPP, JAVA, PY, JS, TS, CS, SWIFT, DTA, PL
Compressed_Files: RAR, ZIP, HQX, ARJ, TAR, ARC, SIT, GZ, Z
Webpage_Files: HTML, HTM, XHTML, ASP, CSS, ASPX, RSS,
3D_Files: OBJ, FBX, GLTF, USD, USDZ, CAD, BLEND, SBSAR, AMF, STL

In this example, we scan files from /path/to/source, move them to /path/to/destination, and sort them into custom subfolders if they match any of the file extension types defined under [Overwrite Destinations].

Examples

Base Use case

To just run the program using the settings from config.ini

yasfs

Using Arguments

Perhaps we want to keep config.ini untouched, and want to change the its settings just for this command... this is where arguments become handy.
Here we override the source and destination file paths from config.ini:

yasfs -s /path/to/source -d /path/to/destination

Here we just override the destination file path from config.ini:

yasfs -d /path/to/destination

We can do the same for the source file path, of course:

yasfs -s /path/to/source

When we sort files, subfolders for their file extension type are automatically created, but what if we don't want to sort files unless their subfolders already exist?

yasfs -sf

Contributing

  1. Fork this repository (https://github.com/ashaider/yet-another-simple-file-sorter/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

Meta

A. Haider – ahmedsyedh1+gh@gmail.com

https://github.com/ashaider/yet-another-simple-file-sorter/

Distributed under the MIT license. See LICENSE for more information.

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

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

Source Distribution

yasfs-1.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

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

yasfs-1.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file yasfs-1.0.tar.gz.

File metadata

  • Download URL: yasfs-1.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for yasfs-1.0.tar.gz
Algorithm Hash digest
SHA256 b6033b9894c3630c66088a9f62e137b16df72de8ca968dec3a4c2cf9f1579f03
MD5 563076e48ff04efd340f6750f816db01
BLAKE2b-256 9588da5c1d6975bb708117a37e1b9cf4aafb86106d20228db1460c3ae8eba452

See more details on using hashes here.

File details

Details for the file yasfs-1.0-py3-none-any.whl.

File metadata

  • Download URL: yasfs-1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for yasfs-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d60ef83cce7e2681e4274ff96c85a60b49d973cd0f08122825d242122193b32b
MD5 ed4160876ae9ded3aa63d927628c409d
BLAKE2b-256 ab5fe3442f2c96f5bbbb1fa826c791987e0d744a7c565def1a589de5d9611cee

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