Skip to main content

Splitting files in a folder

Project description

Split the files in a directory!

This package aims to let a user partition the files in a directory to folders. E.g. one could use this package to split the images of a folder into Train, Validation, and Test. The ratio and the number of splits is customizable. One could also copy the files instead of merely moving them to a different folder.

Installation

pip Install split-up

Usage

Move or copy files of a folder to another, based on a predefined split ratio.

Example:

Import split-up as sp

sp.split_custom(source_folder, destination_folder, 80, 20, copy = True)

The above code would copy the files from the source to the destination folder in 80 : 20 ratio.

Function

split_custom(source_folder, destination_folder, *p, copy = False)

Parameters

Source_folder : The path of the folder containing the files to be split. Destination_folder: The path of the folder where the directories with split files need to be stored. *p: The ratio of the split. E.g. "80,20", "70, 15, 15", "40, 20, 20, 20". The ratio must add upto 100, else an error message would be displayed. (Note: The function does not have a default split ratio.) copy: Set to 'False' by default, it could be set to 'True' in order to copy the file from the source to the destination folder insted of moving.

Output

The files would be present in "Split_(i)" folders, where i = 1, 2, 3...n, depending on the number of splits.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

split_up-1.0.2-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file split_up-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: split_up-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.4 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/50.3.2 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.0

File hashes

Hashes for split_up-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 760c5bf119221feec4c81bb4b7f4d8105d25c1e45cba411ada18a03f9c23e361
MD5 ee88050f2f8b65b03e13f032f04fdcbf
BLAKE2b-256 c7832b424ace2f89035fb6b08c6a3396dab39c0b380126ae6ef8bea0466afef6

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