Skip to main content

Given a list of file names, this will put the list of files into a text file, open that with $EDITOR (or $VISUAL if $EDITOR is not set). After the editor returns, any changed names in the text file will cause a command (default: mv) to be executed with the original and new filename.

This is very useful in carrying out rename operations that are easy to specify with your text editor, but hard to specify with wildcards.

If you ever wrote something like this (and -- as seen here -- still got shell quoting wrong, because it's tedious), then this tool is for you:

for f in *.mp3; do; mv "$f" "$(basename $f .mp3)_foo.mp3"; done

Also, you can use different commands instead of mv, and add options for the input and output parameters (oggenc <infile> -o <outfile>):

rpt -c "oggenc {old} -o {new}" *.wav

If you have a command without {old} and {new}, {old} {new} will be appended to the command line (cp <infile> <outfile>):

rpt -c cp *.wav

You can put {old} and {new} wherever you want, in different order and also multiple times (if needed):

rpt -c "mpg123 -w {new} {old}" *.mp3

To go all-out silly, you can set the $EDITOR variable to something that will automatically change each input line, for example to make a backup file of every .py file in the current folder:

env EDITOR="sed -i -e '/^[^#]/ s/$/.bak/'" rpt -c cp *.py

This will use sed as the editor and in-place edit the temporary text file created by rpt and append .bak to all non-comment lines (the /^[^#]/ part) in the input file, and with cp as the command will call cp <filename> <filename>.bak for every input file.

Release files for rpt 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rpt 2.1.0
File Size Uploaded
rpt-2.1.0.tar.gz 5.0 kB Details

Release files / rpt-2.1.0.tar.gz

Download URL rpt-2.1.0.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0035aba6e1ad54f987f8afe77ee7438d7717b859fbf40d074ffa347b92e04b3e
BLAKE2b-256 checksum
How to use checksums
0e821d535e4f7d9bc6d71db72705a5e03fa15372d7463a0b09b02ac15355dac8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.5

Release history Release notifications | RSS feed

This release

2.1.0 This release

1 release file

2.0.0

1 release file

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page