Paul Hoffman > mkpath-1.01 > mkpath

Download:
mkpath-1.01.tar.gz

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Source  

NAME ^

mkpath - Create directories as needed to ensure that (a) path(s) exists

SYNOPSIS ^

    mkpath [ options ] path...

OPTIONS ^

   -h, --help         Show helpful information and exit.
   
   -m <mode>, --mode <mode>
                      Specify (in 3- or 4-digit octal form) the mode
                      to use when creating directories (default 0755).
   
   -v, --verbose      List (on stdout) any directories (not just
                      paths) created.  This doesn't affect error
                      reporting in any way.
   
   -q, --quiet        Don't report any errors or warnings.
   
   -k, --reckless     Keep trying to create paths even after an error
                      has occurred.  Be careful with this option!
   
   -c, --cleanup      After an error occurs, remove all intermediate
                      directories created.
   
   -o <userid[:groupid]>, --owner <userid[:groupid]>
                      *** NOT IMPLEMENTED YET! ***
                      Specify the owner of created directories.  The
                      default is determined by the OS.  NOTE: In some
                      cases, it may not be possible to set the owner
                      of a directory after creating it; this error is
                      not currently recoverable.
                      
   -x, --example      *** NOT IMPLEMENTED YET! ***
                      Specify a directory to use in determining the
                      owner of created directories.

DESCRIPTION ^

mkpath attempts to ensure that the specified paths (to directories, not to files!) exist, creating directories as needed.

If something goes wrong, mkpath will (if you specify the -c or --cleanup flag) attempt to remove all the directories it successfully created. It will not delete or otherwise alter any pre-existing directories! In other words, mkpath will attempt to create all or none of the paths you specify, without leaving behind any stray directories.

If you want to ensure that a file path exists, you'll have to use File::Spec or some such to split off the file name before handing it off to mkpath.

EXIT STATUS ^

   -2  A path could not be created, but any clean-up required was
       done successfully.

   -1  A path could not be created.
    
    0  All paths were created successfully, or the help option was
       specified.
    
    1  An unrecognized option was given, or no paths were specified.
    
    2  One or more options were invalid (e.g., a malformed mode).

VERSION ^

1.01

CREDITS ^

This script wouldn't exist without File::Path by Tim Bunce and Charles Bailey.

COPYRIGHT ^

Copyright 2003 Paul M. Hoffman. All rights reserved.

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

syntax highlighting: