Skip to main content

A utility for copying files based on pattern matching

Project description

Filesmith

A command-line utility for copying files based on pattern matching, with support for filtering by modification time.

Overview

Filesmith is a Python utility that helps you copy files from one directory to another based on regular expression patterns. It's particularly useful for selective file copying, backup operations, and automated file management tasks.

Installation

You can install filesmith using pip:

pip install filesmith

Usage

filesmith <origin> <destination> <pattern> [options]

Arguments

  • origin: The source directory.
  • destination: The destination directory.
  • pattern: The regex pattern to match filenames against.

Options

  • --newermt <file_or_isodate>: Only copy files newer than a reference file's modification time or a given ISO date/datetime.
  • -n, --dry-run: Show which files would be copied without actually copying them.
  • -q, --quiet: Suppress output for successfully copied files.

Examples

  1. Copy all .txt files from source to dest:

    filesmith /path/to/source /path/to/dest ".*\.txt$"
    
  2. Perform a dry run to see which .jpg files would be copied:

    filesmith /path/to/source /path/to/dest ".*\.jpg$" --dry-run
    
  3. Copy .log files newer than a specific date:

    filesmith /path/to/logs /path/to/backup ".*\.log$" --newermt 2023-10-27T10:00:00
    
  4. Copy .py files that are newer than main.py:

    filesmith /path/to/src /path/to/old_src ".*\.py$" --newermt /path/to/src/main.py
    

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

filesmith-0.1.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

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

filesmith-0.1.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file filesmith-0.1.0.tar.gz.

File metadata

  • Download URL: filesmith-0.1.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for filesmith-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6ae542fd40be6c57e16b3ff39bef16bdd2f30c517c9826a64be3538d75ab4288
MD5 1de75e983ef2441b784c6b90a54e54e3
BLAKE2b-256 4426ebc353023fac5d5b11d6b41890281e572a20f128408c1a57861ea7d40f9e

See more details on using hashes here.

File details

Details for the file filesmith-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: filesmith-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for filesmith-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 72657027f45c7be5a89a02105947fb8de559bd4bb86921555c1c107d00983dfd
MD5 5c8782ab659deb0b931f0d0f88567626
BLAKE2b-256 372d4a88c4ad48ebd579ef9c4ffeabceb19fab2c91939c9107b9ca48821658bb

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