File::Remove(3pm)
๐ NAME ๐
Okay bestie, welcome to the File::Remove(3pm) page โ yes, that's the manual name, and it's a User Contributed Perl Documentation classic. This module is File::Remove, and the whole point is: Remove files and directories. Iconic. It's giving "rm but make it Perl," and honestly? Obsessed.
โจ VERSION โจ
version 1.61 โ that's the version, no cap. ๐ซถ
๐ธ SYNOPSIS ๐ธ
Here's the group-chat screenshot of how you use it, bestie:
use File::Remove 'remove';
# removes (without recursion) several files
remove( '*.c', '*.pl' );
# removes (with recursion) several directories
remove( \1, qw{directory1 directory2} );
# removes (with recursion) several files and directories
remove( \1, qw{file1 file2 directory1 *~} );
# removes without globbing:
remove( \1, {glob => 0}, '*');
# trashes (with support for undeleting later) several files
trash( '*~' );
๐ฆ DESCRIPTION ๐ฆ
Okay so File::Remove::remove removes files and directories. It acts like /bin/rm, for the most part โ like, for the most part, don't come for me. Although unlink can be given a list of files, it will not remove directories; this module remedies that. It also accepts wildcards, * and ?, as arguments for filenames. Slay.
File::Remove::trash accepts the same arguments as remove, with the addition of an optional, infrequently used "other platforms" hashref. Noted, bestie.
๐๏ธ SUBROUTINES ๐๏ธ
๐๏ธ remove
Removes files and directories. Directories are removed recursively like in rm -rf if the first argument is a reference to a scalar that evaluates to true. If the first argument is a reference to a scalar, then it is used as the value of the recursive flag. By default it's false so only pass \1 to it. Only \1, okay? Don't be extra.
If the next argument is a hash reference then it is a key/values of options. Currently, there is one supported option of 'glob' => 0 which prevents globbing. E.g:
remove(\1, {glob => 0}, '*');
Will not remove files globbed by * and will only remove the file called asterisk if it exists. Subtle but important, iykyk.
In list context it returns a list of files/directories removed, in scalar context it returns the number of files/directories removed. The list/number should match what was passed in if everything went well. Vibe check: passed. โจ
๐งน rm
Just calls remove. It's there for people who get tired of typing remove. Honestly? Relatable.
๐งผ clear
The clear function is a version of remove designed for use in test scripts. It takes a list of paths that it will both initially delete during the current test run, and then further flag for deletion at END-time as a convenience for the next test run. Test-script main character energy.
๐ฎ trash
Removes files and directories, with support for undeleting later. Accepts an optional "other platforms" hashref, passing the remaining arguments to remove. Trash, but with undeleting later in the mix.
๐ช Win32
Requires Win32::FileOp.
Installation not actually enforced on Win32 yet, since Win32::FileOp has badly failing dependencies at time of writing. Warning: dependency drama, no cap.
๐ OS X
Requires Mac::Glue.
๐ Other platforms
The first argument to trash() must be a hashref with two keys, 'rmdir' and 'unlink', each referencing a coderef. The coderefs will be called with the filenames that are to be deleted. Your coderefs, your rules, bestie.
๐ซ expand
DO NOT USE. Kept for legacy.
๐ซ undelete
DO NOT USE. Kept for legacy.
๐ซถ SUPPORT ๐ซถ
Bugs should always be submitted via the CPAN bug tracker
<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=File-Remove>
For other issues, contact the maintainer.
๐ AUTHOR ๐
Adam Kennedy <adamk@cpan.org> โ yes, that's the author. Legend behavior.
๐ COPYRIGHT ๐
Taken over by Shlomi Fish (<http://www.shlomifish.org/>) while disclaiming all rights and placing his modifications under CC0/public-domain/MIT/any-other-licence.
Some parts copyright 2006 - 2012 Adam Kennedy.
Taken over by Adam Kennedy <adamk@cpan.org> to fix the "deep readonly files" bug, and do some package cleaning.
Some parts copyright 2004 - 2005 Richard Soderberg.
Taken over by Richard Soderberg <perl@crystalflame.net> to port it to File::Spec and add tests.
Original copyright: 1998 by Gabor Egressy, <gabor@vmunix.com>.
This program is free software; you can redistribute and/or modify it under the same terms as Perl itself. Licensing slay.
๐ SUPPORT ๐
๐ Websites
The following websites have more information about this module, and may be of help to you. As always, in addition to those websites please use your favorite search engine to discover more resources.
- MetaCPAN โ A modern, open-source CPAN search engine, useful to view POD in HTML format.
<https://metacpan.org/release/File-Remove> - RT: CPAN's Bug Tracker โ The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
<https://rt.cpan.org/Public/Dist/Display.html?Name=File-Remove> - CPANTS โ The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
<http://cpants.cpanauthors.org/dist/File-Remove> - CPAN Testers โ The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
<http://www.cpantesters.org/distro/F/File-Remove> - CPAN Testers Matrix โ The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
<http://matrix.cpantesters.org/?dist=File-Remove> - CPAN Testers Dependencies โ The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
<http://deps.cpantesters.org/?module=File::Remove>
๐ Bugs / Feature Requests
Please report any bugs or feature requests by email to "bug-file-remove at rt.cpan.org", or through the web interface at <https://rt.cpan.org/Public/Bug/Report.html?Queue=File-Remove>. You will be automatically notified of any progress on the request by the system. Bug reports = self-care.
๐พ Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull from your repository :)
<https://github.com/shlomif/File-Remove>
git clone git://github.com/shlomif/File-Remove.git
๐ AUTHOR ๐
Shlomi Fish <shlomif@cpan.org> โ second AUTHOR section, still iconic. Double author reveal, periodt.
๐ BUGS ๐
Please report any bugs or feature requests on the bugtracker website <http://rt.cpan.org/NoAuth/Bugs.html?Dist=File-Remove> or by email to bug-file-remove@rt.cpan.org <mailto:bug-file-remove@rt.cpan.org>. Yes, that's the correct link, bestie.
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. Receipts or it didn't happen. ๐งพ
๐ COPYRIGHT AND LICENSE ๐
This software is copyright (c) 1998 by Gabor Egressy.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Free software, free vibes.
๐ Cute sign-off: this page is File::Remove(3pm), from perl v5.42.0, dated 2022-06-14. Mwah! ๐
๐ฆ where this page comes from
- opensuse-leap 16.0: perl-File-Remove 1.61-bp160.1.12 ยท Artistic-1.0 OR GPL-1.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms