https://github.com/panta/sample-n-files
Randomly selects N files from a source directory, printing the names and/or copying to a destination directory.
https://github.com/panta/sample-n-files
command-line pex python python3 tool utility
Last synced: 8 months ago
JSON representation
Randomly selects N files from a source directory, printing the names and/or copying to a destination directory.
- Host: GitHub
- URL: https://github.com/panta/sample-n-files
- Owner: panta
- License: apache-2.0
- Created: 2018-10-22T08:42:50.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-22T13:00:28.000Z (over 7 years ago)
- Last Synced: 2025-02-14T22:51:40.233Z (over 1 year ago)
- Topics: command-line, pex, python, python3, tool, utility
- Language: Python
- Size: 7.81 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
README
======
The `sample-n-files` command randomly selects `N` files from a source directory, printing the names and/or copying to a destination directory.
It requires Python 3 (tested with 3.6.5).
The build procedure creates a [pex](https://pex.readthedocs.io/en/stable/),
which embeds all the dependencies in a single executable, and that can then be installed wherever you see fit.
## Building and installing
To build:
```bash
$ make build
```
To install:
```bash
$ make install
```
## Using
```bash
$ sample-n-files --help
Usage: sample_n_files [OPTIONS] SRC DST
Sample `count` files, copying them from `src` to `dst`
Options:
--count INTEGER Number of file to sample.
--prefix TEXT Prefix of the files to consider
--printonly BOOLEAN Print only instead of copying
--verbose BOOLEAN Be verbose
--help Show this message and exit.
$ sample-n-files --count 25 --prefix "dog" --verbose yes cat_vs_dog/ dogs_selection/
...
```