ap / rename Goto Github PK
View Code? Open in Web Editor NEWRename multiple files
Home Page: http://plasmasturm.org/code/rename/
License: Other
Rename multiple files
Home Page: http://plasmasturm.org/code/rename/
License: Other
Hi, I was hoping you could create a release for this really awesome tool. https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository
Macos Mojave, version 1.601, installed via homebrew.
$ rename -n -N 10 's/.*/V1D2E$N.mkv/' *.mkv
Error: unparseable counter format 10
vs
$ rename -n -N 010 's/.*/V1D2E$N.mkv/' *.mkv
'title_t00.mkv' would be renamed to 'V1D2E010.mkv'
'title_t01.mkv' would be renamed to 'V1D2E011.mkv'
'title_t02.mkv' would be renamed to 'V1D2E012.mkv'
'title_t03.mkv' would be renamed to 'V1D2E013.mkv'
'title_t04.mkv' would be renamed to 'V1D2E014.mkv'
'title_t05.mkv' would be renamed to 'V1D2E015.mkv'
'title_t06.mkv' would be renamed to 'V1D2E016.mkv'
'title_t07.mkv' would be renamed to 'V1D2E017.mkv'
'title_t08.mkv' would be renamed to 'V1D2E018.mkv'
Man page says:
$N A counter that increments for each file in the list. By default, counts up from 1.
The "-N" switch takes a template that specifies the padding and starting value of $N; see "Switches".
Expected behaviour:
Providing a parameter like 10
implies the starting value of $N
should be 10 and there should be no zero padding.
Let's say I have a file called bob’s.txt
. I run prename on it and get:
• prename -n --noctrl bob’s.txt
'bob’s.txt' would be renamed to 'bob�_s.txt'
Actually running the command would result in the file being named 62 6f 62 E2 5F 73 2E 74 78 74, which is invalid UTF-8 because of the E2 byte. I don't think this should happen.
--delete
and --delete-all
is listed in the usage syntax description on the top, in the man pages, but it isn't documented later on :)
i know its packaged on homebrew on Macos. is it anywhere else?
$ brew info rename
rename: stable 1.600 (bottled), HEAD
Perl-powered file rename script with many helpful built-ins
http://plasmasturm.org/code/rename
Conflicts with:
util-linux (because both install `rename` binaries)
/usr/local/Cellar/rename/1.600_1 (4 files, 41.9KB) *
Poured from bottle on 2018-09-10 at 16:13:29
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/rename.rb
==> Options
--HEAD
Install HEAD version
==> Analytics
$ rename -- '_%28Civ5%29' '' *
install: 3,789 (30 days), 13,064 (90 days), 47,263 (365 days)
install_on_request: 3,472 (30 days), 11,602 (90 days), 43,035 (365 days)
build_error: 0 (30 days)
Bareword found where operator expected at (eval 2) line 1, near "28Civ5"
(Missing operator before Civ5?)
Bareword "_" not allowed while "strict subs" in use at (eval 2) line 1.
syntax error at (eval 2) line 1, near "28Civ5"
(continued from #8)
rename
gave up) :Of course, it's playing dirty serving rename
a diet of filenames that only consists of the most impossible-to-handle characters: '$' and '/' and '*' and such... but it's apparently perfectly valid file names in Finder. I work as a consultant working exclusively with networked macOS and iOS boxes around town, and nothing shocks me anymore - if it can be typed, it will end up in a file or folder name sooner or later. And, somewhere along the way, backblaze, rsync, time machine, xar or ditto or even more probably: one of my shell glue scripts, one of those are going to get thrown way off balance by that ' / ' or ' /" ' ...
Don't know if its worth spending the time to band-aid these incredible corner cases, but now at least you are aware of a few perfect 90.000 degree corner cases.
Perhaps you have to go the route of identifying the inode
of the file/folder and calling dd(1)
[sp?] to zero-out the corresponding parts in the directory?
Anyways.. thanks for a great utility! It's hard at work over here in Oslo, Norway.
//haakon
👋 Just found this repo does not have any license, it would be good to add OSI-approved one, https://spdx.org/licenses/
Some popular license choice would be:
Command-line says more than words:
$ touch UPPERCASE
$ rename -c UPPERCASE
'UPPERCASE' not renamed: 'uppercase' already exists
This was on macOS 12.3.1 on a case-insensitive APFS filesystem.
It would be great if the lower case renaming would work natively. Currently I have to make a wrapper in my renaming script for macOS to rename to a temporary file.
A workaround currently exist by forcing an overwrite
$ rename -c -f UPPERCASE
The output of prename -h
is
Usage:
rename [switches|transforms] [files]
Switches:
-0/--null (when reading from STDIN)
-f/--force or -i/--interactive (proceed or prompt when overwriting)
Wide character in print at /usr/share/perl5/core_perl/Pod/Text.pm line 303.
-g/--glob (expand "*" etc. in filenames, useful in Windows™ CMD.EXE)
-k/--backwards/--reverse-order
-l/--symlink or -L/--hardlink
-M/--use=Module
-n/--just-print/--dry-run
-N/--counter-format
-p/--mkpath/--make-dirs
--stdin/--no-stdin
-t/--sort-time
-T/--transcode=encoding
-v/--verbose
Transforms, applied sequentially:
-a/--append=str
-A/--prepend=str
-c/--lower-case
-C/--upper-case
-d/--delete=str
-D/--delete-all=str
-e/--expr=code
-P/--pipe=cmd
-s/--subst from to
-S/--subst-all from to
-x/--remove-extension
-X/--keep-extension
-z/--sanitize
--camelcase --urlesc --nows --rews --noctrl --nometa --trim (see manual)
Is there a way to fix the Wide character in print at /usr/share/perl5/core_perl/Pod/Text.pm line 303
? I assume it's related to the (tm) that is printed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.