1

add unpack_and_move.pl, batch recursive 7z unpack script

This commit is contained in:
eleksir
2017-02-01 20:25:39 +03:00
parent 359f09eb5c
commit 033d5a49f6

19
unpack_and_move.pl Executable file
View File

@@ -0,0 +1,19 @@
#!/usr/bin/perl
# finds in current dir 7z compressed file, makes dir according filename,
# move file to that dir, unpack file to that dir, remove file
opendir(S, ".");
@list = readdir(S);
foreach (@list) {
next if ($_ eq ".");
next if($_ eq "..");
$filename = $_;
$name = (split(/\.7z/, $filename))[0];
next unless (mkdir($name));
system("mv", $filename, $name);
next unless (chdir($name));
system("7z", "x", $filename);
unlink($filename);
chdir("..");
}