GSP
Quick Navigator

Search Site

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

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
No::Worries::Dir(3) User Contributed Perl Documentation No::Worries::Dir(3)

No::Worries::Dir - directory handling without worries

  use No::Worries::Dir
      qw(dir_change dir_ensure dir_make dir_parent dir_read dir_remove);

  # change directory
  dir_change("/tmp");

  # make sure a directory exists (not an error if it exists already)
  dir_ensure("/tmp/some/path", mode => oct(770));

  # make a directory (an error if it exists already)
  dir_make("/tmp/some/path", mode => oct(770));

  # find out the parent directory of some path
  $parent = dir_parent($path);
  dir_ensure($parent);

  # read a directory
  foreach $name (dir_read("/etc")) {
      ...
  }

  # remove a directory
  dir_remove("/tmp/some/path");

This module eases directory handling by providing convenient wrappers around standard directory functions. All the functions die() on error.

This module provides the following functions (none of them being exported by default):
dir_change(PATH)
change the working directory to the given path; this is a safe thin wrapper on top of chdir()
dir_ensure(PATH[, OPTIONS])
make sure the given path is an existing directory, creating it (including its parents) if needed; supported options:
"mode": numerical mode to use for mkdir() (default: oct(777))
dir_make(PATH[, OPTIONS])
make the given directory; this is a safe thin wrapper on top of mkdir(); supported options:
"mode": numerical mode to use for mkdir() (default: oct(777))
dir_parent(PATH)
return the parent directory of the given path
dir_read(PATH)
read the given directory and return its list of entries except "." and ".."
dir_remove(PATH)
remove the given directory (that must exist and be empty); this is a safe thin wrapper on top of rmdir()

No::Worries.

Lionel Cons <http://cern.ch/lionel.cons>

Copyright (C) CERN 2012-2019

2021-10-15 perl v5.32.1

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

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