add unpack_and_move.pl, batch recursive 7z unpack script
This commit is contained in:
19
unpack_and_move.pl
Executable file
19
unpack_and_move.pl
Executable 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("..");
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user