Skip to main content

Apply a filter to the directory tree

Project description

filtertree

Apply a filter to the directory tree.

Install

filtertree can be installed with pip:

$ pip install filtertree

Usage

filtertree module provides a function filtertree.

from filtertree import filtertree

filtertree(func, src_dir_path, dest_dir_path, overwrite=overwrite)

Arguments are:

  • func is a filter function that takes 2 arguments, source and destination file paths.
  • src_dir_path is a base directory path for source.
  • dest_dir_path is a base directory path for destination.
  • overwrite is a flag to overwrite destination files.

filtertree function applies func to each file under src_dir_path directory tree and the same location under dest_dir_path.

If overwrite is True, overwrite the destination files, Or not. Default to False.

CLI tool filtre

filtre applies command to src_dir directory tree as follows:

$ filtre src_dir dest_dir cp

Or you can give one-line-script with -c option.

$ filtre -c "cp $1 $2" src_dir dest_dir

$1 and $2 in one-lien-script are replaced by src and dest file paths.

If -o / --overwite option is passed, overwrite the destination files. Otherwise, skip.

License

MIT license.

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

filtertree-0.2.0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

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

filtertree-0.2.0-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file filtertree-0.2.0.tar.gz.

File metadata

  • Download URL: filtertree-0.2.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.12.8 Linux/6.8.0-51-generic

File hashes

Hashes for filtertree-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6124604ff58b8de036092d698a3767e513971743dc37dbda3c69547a589d7caf
MD5 a35413ad83f9ba618227bbe04e082abb
BLAKE2b-256 27933ef9d0f122917dc64d8c681c363de94aee1f87870a768b6a0e9a9845a4cb

See more details on using hashes here.

File details

Details for the file filtertree-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: filtertree-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.12.8 Linux/6.8.0-51-generic

File hashes

Hashes for filtertree-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c6ae0e144335265b84d2283d4cd040dff5374ab34be5723eee66e826a6f511bc
MD5 ed9021dc41fe8ccd7837bdaf92ef1040
BLAKE2b-256 46dcaeab17669dde19da98cbb9e08c3187b73ee26b381fce682638d0081f7ec5

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