File::Rename(3pm)
π File::Rename π
okay bestie, welcome to File::Rename β a User Contributed Perl Documentation situation, and it's literally the Perl extension for renaming multiple files at once. no cap. you're gonna love her. π¦
β¨ NAME β¨
File::Rename β Perl extension for renaming multiple files π
πΈ SYNOPSIS πΈ
use File::Rename qw(rename); # hide CORE::rename
rename \@ARGV, sub { s/\.pl\z/.pm/ }, 1;
use File::Rename;
File::Rename::rename \@ARGV, '$_ = lc';
use File::Rename qw(:config no_require_order);
look at her go. she's giving versatile. π
π DESCRIPTION π
π§ USE OPTIONS
so when you do use File::Rename, the parameters you pass are made of two things: the functions you wanna import, and the configuration options. that's it, that's the whole vibe.
the only exported function is rename(). iconic. singular. main character.
the configuration options come with a :config prefix in front of them, and they get handed off to File::Rename::Options. yes, she's delegating, and she's right to. π«Ά
π FUNCTIONS
rename( FILES, CODE [, VERBOSE])β renames FILES using CODE. and listen: if FILES is empty, she'll read the list of files fromstdin. sneaky but slay. β¨rename_files( CODE, VERBOSE, FILES)β renames FILES using CODE. that's the whole thing, bestie.rename_list( CODE, VERBOSE, HANDLE [, FILENAME])β renames a list of files read from HANDLE, using CODE. π«
π OPTIONS
FILESβ the list of files to be renamed. forrenamethis must be an ARRAY reference. not optional, not vibes-based, an actual arrayref. πCODEβ the subroutine that changes the file names. forrenameit can be a string; otherwise it's a code reference.VERBOSEβ flag for printing the names of files that got successfully renamed. optional forrename. πHANDLEβ the filehandle to read the file names that are gonna be renamed.FILENAME(Optional) β the name of the file that HANDLE reads from.
π HASH
plot twist: either CODE or VERBOSE can be a HASH of options. yes really.
if CODE is a HASH, then VERBOSE gets ignored entirely and CODE is supplied by the _code key. okay so she said "one of you is doing double duty and it's you, CODE." π
the other options are:
verboseβ same as VERBOSE up above. provided by-v.input_nullβ input separator\0when reading file names from stdin.no_actionβ prints the names of the files that would be renamed, but does not rename them (i.e. takes no action). provided by-n.over_writeβ lets files be over-written by the renaming. provided by-f.filename_onlyβ only applies the renaming to the filename component of the path. provided by-d.show_helpβ prints help. provided by-h.show_manualβ prints the manual page. provided by-m.show_versionβ prints the version number. provided by-V.unicode_stringsβ enables theunicode_stringsfeature. provided by-u.encodingβ encoding for filenames. provided by-u.
β EXPORT
rename
just the one. she's exclusive. π
π ENVIRONMENT π
No environment variables are used.
literally zero. she doesn't need them, she doesn't want them, she's self-sufficient. π§
π₯ SEE ALSO π₯
the squad. π«Ά
π AUTHOR π
Robin Barker <RMBarker@cpan.org>
π« Acknowledgements
Based on code from Larry Wall. π
Options -e, -f, -n suggested by more recent code written by Aristotle Pagaltzis. shoutout, fr fr. β¨
π DIAGNOSTICS π
Errors from the code argument are not trapped.
bestie. read that again. if your code argument throws, nothing catches it. no safety net, no hands, no cap. it is what it is and it will simply happen to you. π
πΈ COPYRIGHT AND LICENSE πΈ
Copyright (C) 2004, 2005, 2006, 2011, 2018, 2021, 2022, 2023 by Robin Barker
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available.
and that's the whole page, bestie!! π this doc came to you from perl v5.36.0, dated 2023-01-23, and it lives at File::Rename(3pm). mwah. go rename some files. π
β¨π¦
π¦ where this page comes from
- debian bookworm: rename 2.01-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms