目地:從 file full path 取出 directory
$backup_file = "D:/Auto/aaa/bbbb/20121121.xls";
while ($backup_file =~ /\//g) {
$dir_end = pos($backup_file);
}
$bakdir = substr($backup_file, 0, $dir_end);
print $bakdir;
Reference:
http://blog.xuite.net/abliou/perl/23232393