Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  FILE::REMOVE (3)

.ds Aq ’


File::Remove - Remove files and directories



    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 *~} );

    # trashes (with support for undeleting later) several files
    trash( *~ );


<B>File::Remove::removeB> removes files and directories. It acts like <B>/bin/rmB>, for the most part. 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.

<B>File::Remove::trashB> accepts the same arguments as <B>removeB>, with the addition of an optional, infrequently used other platforms hashref.



Removes files and directories. Directories are removed recursively like in <B>rm -rfB> if the first argument is a reference to a scalar that evaluates to true. If the first arguemnt 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.

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.


Just calls <B>removeB>. It’s there for people who get tired of typing <B>removeB>.


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.


Removes files and directories, with support for undeleting later. Accepts an optional other platforms hashref, passing the remaining arguments to <B>removeB>.
Win32 Requires Win32::FileOp.

Installation not actually enforced on Win32 yet, since Win32::FileOp has badly failing dependencies at time of writing.

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.


Bugs should always be submitted via the CPAN bug tracker


For other issues, contact the maintainer.


Adam Kennedy <>


Some parts copyright 2006 - 2012 Adam Kennedy.

Taken over by Adam Kennedy <> to fix the deep readonly files bug, and do some package cleaning.

Some parts copyright 2004 - 2005 Richard Soderberg.

Taken over by Richard Soderberg <> to port it to File::Spec and add tests.

Original copyright: 1998 by Gabor Egressy, <>.

This program is free software; you can redistribute and/or modify it under the same terms as Perl itself.

Search for    or go to Top of page |  Section 3 |  Main Index

perl v5.20.3 FILE::REMOVE (3) 2012-03-19

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.