{"id":147,"date":"2005-09-13T17:42:35","date_gmt":"2005-09-13T14:42:35","guid":{"rendered":"https:\/\/void.gr\/kargig\/blog\/?p=147"},"modified":"2005-10-12T01:38:07","modified_gmt":"2005-10-11T22:38:07","slug":"crude-script-for-sfv-checking","status":"publish","type":"post","link":"https:\/\/www.void.gr\/kargig\/blog\/2005\/09\/13\/crude-script-for-sfv-checking\/","title":{"rendered":"crude script for sfv checking"},"content":{"rendered":"<p>Most of the times, when I download something and there&#8217;s an sfv file available I check the files against the sfv. That saves me from a lot of trouble later on&#8230;<br \/>\nWhat I wanted though, was to have the sfv check program create a dir inside each folder it checks that would include the details from the sfv scanning. That way you can instantly know whether what you have downloaded 1 week ago is ok, or there are bad files inside, or missing files. I sometimes used to check what I downloaded against the sfv file but I forgot to move it to my &#8220;complete&#8221; folder. So I made a VERY crude script that does exactly what I want. It uses pure-sfv (which I think is a bit faster than all the others I&#8217;ve tested) and then parses the output to create a dir that looks like this:<\/p>\n<blockquote><p> [ 49 OK, 0 BAD, 0 MISSING, OUT OF 49 ]  <\/p><\/blockquote>\n<p>Here&#8217;s the script&#8230;<br \/>\n<code>#!\/bin\/bash<\/p>\n<p>THEOLDDIR=`ls -1 | grep \"MISSING, OUT OF\"` ; rm -rf \"$THEOLDDIR\"<br \/>\nACTION=`pure-sfv *.sfv | egrep \"different CRC|Tested|No such file\" > check.tst`<br \/>\nTHEBADONES=`grep different check.tst`<br \/>\nTHEMISSONES=`grep \"No such file\" check.tst`<br \/>\nLINECOUNT=`wc -l check.tst | cut -d\" \" -f 1`<br \/>\nOKFILES=`tail -n1 check.tst | cut -d\" \" -f5 | cut -d\",\" -f1 `<br \/>\nBADFILES=`tail -n1 check.tst | cut -d\" \" -f7 | cut -d\",\" -f1 `<br \/>\nMISSFILES=`tail -n1 check.tst | cut -d\" \" -f9`<br \/>\nwhile read line ;do<br \/>\n   BADIS=`echo $line | cut -d\" \" -f 1`<br \/>\n   if [ $BADIS != \"Tested\" ]; then<br \/>\n        if [ -e $BADIS ]; then<br \/>\n        mv $BADIS $BADIS.bad<br \/>\n        else<br \/>\n        touch $BADIS.missing<br \/>\n        fi<br \/>\n   fi<br \/>\ndone &lt; check.tst<br \/>\necho \"$THEBADONES\"<br \/>\necho \"$THEMISSONES\"<br \/>\necho \"$OKFILES OK, $BADFILES BAD, $MISSFILES MISSING, OUT OF $[$OKFILES+$BADFILES+$MISSFILES]\"<br \/>\nmkdir -p \"[ $OKFILES OK, $BADFILES BAD, $MISSFILES MISSING, OUT OF $[$OKFILES+$BADFILES+$MISSFILES] ]\" ; rm -f check.tst<br \/>\n<\/code><\/p>\n<p><em><strong>USE IT AT YOUR OWN RISK!!! IT MAY DELETE ALL YOUR FILES. IT WON&#8217;T BE MY FAULT!<\/strong><\/em><\/p>\n<p>and yes I know the code sucks. If you don&#8217;t like it don&#8217;t use it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Most of the times, when I download something and there&#8217;s an sfv file available I check the files against the sfv. That saves me from a lot of trouble later on&#8230; What I wanted though, was to have the sfv check program create a dir inside each folder it checks that would include the details [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ep_exclude_from_search":false,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-147","post","type-post","status-publish","format-standard","hentry","category-linux"],"aioseo_notices":[],"views":3422,"_links":{"self":[{"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/posts\/147","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/comments?post=147"}],"version-history":[{"count":0,"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/posts\/147\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/media?parent=147"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/categories?post=147"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/tags?post=147"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}