-
Notifications
You must be signed in to change notification settings - Fork 1
/
ChecksumsInFolders.xys
39 lines (36 loc) · 1.53 KB
/
ChecksumsInFolders.xys
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
::/** XYplorer: Generate folders checksums
Creates a MD5 checksum file for selected folders.
Just select some folders in any panel and run. It will scan all subfiles/subfolders within and generate a md5 checksum file in each folder.
The checksum file will be like [folder-name].md5 .
It will ignore the folder if there is already a checksum in it. The checksum also ignores any existing .md5 or .sfv files.
At the end, it shows the execution log.
@author rdoi
@created feb/2014
*/
$log="ChecksumsInFolders.xys: RDoi folders MD5 checksum creator<crlf>-------------------------------<crlf>";
foreach($folder, "<get SelectedItemsPathNames>", "<crlf>") {
$log=$log."Processing ".$folder."...<crlf>";
if (exists($folder) == 1) {
$log=$log."-SKIPPED: Not a folder.<crlf>";
} else {
$csfile=$folder."\".regexreplace($folder,"^.*\\", "").".md5";
if (exists($csfile) == 1) {
$log=$log."-IGNORED: Checksum exists. (".$csfile.")<crlf>";
} else {
$checksum="; MD5 checksum generated by RDOI XYplorer script<crlf>; ".$folder."<crlf>";
foreach($file, folderreport("filesrel", "r", $folder, "r", , "|"), "|") {
$filepath=$folder."\".$file;
if ( regexmatches($filepath,"(\.md5|\.sfv)$") == "") {
$hash=hash("md5",$filepath,3);
$checksum=$checksum.$hash." *".$file."<crlf>";
} else {
$log=$log."-IGNORED: Checksum file. (".$filepath.")<crlf>";
}
}
writefile($csfile,$checksum);
$log=$log."+CREATED. (".$csfile.")<crlf>";
}
}
$log=$log."<crlf>";
}
text $log;