分类: IT业界
2011-06-28 17:33:21
脚本如下:
#!/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