Приглашаем посетить
Право (law.niv.ru)

[Chapter 7] 7.2.31 File::Path - Create or Remove a Series of Directories

PreviousChapter 7
The Standard Perl Library
Next
 

7.2.31 File::Path - Create or Remove a Series of Directories

use File::Path;

mkpath(['/foo/bar/baz', 'blurfl/quux'], 1, 0711);
rmtree(['/foo/bar/baz', 'blurfl/quux'], 1, 1);

The mkpath() function provides a convenient way to create directories, even if your mkdir(2) won't create more than one level of directory at a time. mkpath() takes three arguments:

It returns a list of all directories created, including intermediate directories, which are assumed to be delimited by the UNIX path separator, /.

Similarly, the rmtree() function provides a convenient way to delete a subtree from the directory structure, much like the UNIX rm -r command. rmtree() takes three arguments:

rmtree() returns the number of files successfully deleted. Symbolic links are treated as ordinary files.


PreviousHomeNext
7.2.30 File::Find - Traverse a File TreeBook Index7.2.32 FileCache - Keep More Files Open Than the System Permits