eeb0735e7b
calls an external program to extract them. It looks at "magic bytes" in file contents, so it can be used both as an undelete utility and for recovering a corrupted drive or partition. As long as the file data is there, it will find it. It works on any file system, but on very fragmented file systems it can only recover the first chunk of each file. Practical experience shows, however, that chunks of 30-50MB are not uncommon. PR: ports/83666 Submitted by: Emanuel Haupt <ehaupt@mx.critical.ch> Approved by: flz (mentor)
20 lines
559 B
Text
20 lines
559 B
Text
--- magicsort.orig Mon Jul 18 11:55:35 2005
|
|
+++ magicsort Mon Jul 18 12:03:01 2005
|
|
@@ -13,7 +13,7 @@
|
|
while (defined(my $file = readdir DH)) {
|
|
next unless -f $file;
|
|
|
|
- open FILE, "-|", "file", $file or die "Executing file: $!\n";
|
|
+ open(FILE, 'file '.$file.'|') or die "Executing file: $!\n";
|
|
my $idstring = <FILE>;
|
|
close FILE;
|
|
|
|
@@ -25,7 +25,7 @@
|
|
next;
|
|
}
|
|
my $dir = substr($idstring, length($file) + 2);
|
|
- mkdir $dir;
|
|
+ mkdir $dir,0755;
|
|
rename $file, "$dir/$file" or warn "Cannot move $file: $!\n";
|
|
}
|
|
|