Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

A Pylp plugin for renaming files in a stream

Project description

Information

pylprename is a plugin for Pylp that rename files in a stream.

Installation

Install pylprename with pip:

pip install pylprename

If you don’t have Python Scripts folder in your PATH, you can run also:

python -m pip install pylprename

Usage

import pylp
from pylprename import rename

# Rename with a string
pylp.src('src/main/text/hello.txt')
  .pipe(rename('ciao/goodbye.md'))
  .pipe(pylp.dest('dist'))  # ./dist/ciao/goodbye.md


# Rename with a function
pylp.src('src/main/text/hello.txt')
  .pipe(rename(lambda n:
    n.replace('ell', 'all')
  ))
  .pipe(pylp.dest('dist'))  # ./dist/hallo.txt


# Rename with some values (all values are optional)
pylp.src('src/main/text/hello.txt')
  .pipe(rename(
    dirname='md/ciao',
    basename='aloha',
    prefix='bonjour-',
    suffix='-hola',
    ext='.md'
  ))
  .pipe(pylp.dest('dist'))  # ./dist/md/ciao/bonjour-aloha-hola.md

Notes

  • basename is the filename without the extension
  • ext is the file extension including the ‘.’

Project details


Release history Release notifications

Download files

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

Files for pylprename, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size pylprename-0.1.1-py3-none-any.whl (4.3 kB) File type Wheel Python version py3 Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page