该模块类似shell下的mkdir的功能。
脚本如下:
#!/usr/bin/perl
use strict;
use warnings;
use File::Path qw(make_path remove_tree);
make_path(
'/home/sysadmin/aaa/test/bb/test',
{
verbose => 1,
mode => 0711,
}
);
remove_tree(
'/home/sysadmin/aaa/test',
{
verbose => 1,
error => \my $err_list,
}
);
运行脚本如下:
[root@localhost crontab]# ./file_path.pl
mkdir /home/sysadmin
mkdir /home/sysadmin/aaa
mkdir /home/sysadmin/aaa/test
mkdir /home/sysadmin/aaa/test/bb
mkdir /home/sysadmin/aaa/test/bb/test
rmdir test
rmdir bb
rmdir /home/sysadmin/aaa/test
阅读(1384) | 评论(0) | 转发(1) |