diff --git a/unpack_and_move.pl b/unpack_and_move.pl new file mode 100755 index 0000000..c0cae79 --- /dev/null +++ b/unpack_and_move.pl @@ -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(".."); +}