Date: Wed, 19 Jan 2000 20:37:39 -0800 From: Mike Heilmann To: etree-digest@etree.org Subject: [etree] WinNT Automated PERL script for shn's --> wav's this automated script is for WIN NT users ( FINALLY! ) and requires PERL to be installed on your local system. the script assumes both shortn32 and md5sum are in your PATH variable. I hacked this together...it's about 80% feature complete. It's ugly but gets the job done...all you need to do is fill in $dirname and $md5name for each show and then double click. It checks the md5sum and then decompresses your files in the same dir. I have little time for dev work and would love some input/improvements/feedback regarding the script. I'll do my best to support those who have questions. have fun, mike ---> Start your cut and paste and save in a file called shortn.pl. #!/usr/local/bin/perl # use strict; my ($dirname); my ($md5name); #### SET THIS DIR TO POINT TO .SHN FILES ######### ## ## ## ## $dirname = "G:\\ph99-12-18.shnf\\ph99-12-18d3.shnf\\"; $md5name = "ph99-12-18d3.md5"; ## ## ## ## ################################################## # Var. Declar. my ($file); my ($uncompress); my ($shortn_cmd); my (@file_list); my (@shn_list); my (@md5_list); my ($md5sum_cmd); my ($entry); my ($md5exe); my ($md5bat_execute); my ($md5copy); my ($md5file); # Set Local Vars $file = ""; $uncompress = ""; $md5exe = ""; $shortn_cmd = "shortn32 -x "; $md5sum_cmd = "md5sum --check "; $entry = 0; @file_list = ""; my ($i) = 0; my ($control) = 0; opendir(DIR, $dirname) or die "can't open $dirname: $!"; while (defined($file = readdir(DIR))) { @file_list[$i] = $file; $i++; $file = ""; } $i = 0; @shn_list = grep /.+\.shn/ , @file_list; @md5_list = grep /.+\.md5/ , @file_list; $control = scalar(@shn_list) - 1; print "Shortn found the following md5 File:\n@md5_list \n\n"; print "Shortn found the following shn Files:\n@shn_list \n\n"; # Create the .bat file for processing open(BATFILE, "> $dirname" . "md5check.bat"); print BATFILE "g:\n"; print BATFILE "cd $dirname\n"; $md5exe = $md5sum_cmd . $md5name; print "\n\n\n\n++++++++++++++++ STARTING MD5 CheckSUM NOW ++++++++++++++++\n\n\n\n\n\n"; print "\n\nExecuting $md5exe write to md5check.bat \n\n"; print BATFILE "$md5exe\n"; close (BATFILE); #Run the bat file $md5bat_execute = $dirname . "md5check.bat"; system ( $md5bat_execute ); print "\n\n\n\n++++++++++++++++ MD5 CheckSUM FINISHED, STARTING DECOMPRESSION ++++++++++++++++\n\n\n\n\n"; # Decompress the shn's $i = 0; while ($control >= $i) { $uncompress = $shortn_cmd . $dirname . @shn_list[$i] . " $dirname@shn_list[$i].wav"; printf ("\nExecuting $uncompress \n\n"); system ( $uncompress ); $i++; } print "\n\n\n\n\t\t\t\t+++++++++Shortn Complete++++++++++\n"; sleep (2);