# convert output of DOS DIR command to RDF conforming to # http://www.semanticdesktop.org/ontologies/2007/03/22/nfo ontology # run with # dir | perl dir2nfordf.pl # 2009-11-06 Bob DuCharme no warrantee expressed or implied $header = " "; print $header; while (<>) { chop($_); if (/(\d\d\/\d\d\/\d\d\d\d)\s+(\d\d):(\d\d) ([A|P]M)\s+((\d+,)?\d+) (.*)/) { $date = $1; $hour = $2; $fileSize = $5; $filename = $7; # Convert date to ISO 8609 format $hour += 12 if ($4 == "PM"); @dateFields = split(/\//,$date); $dateTime = @dateFields[2] . "-" . @dateFields[0] . "-" . @dateFields[1] . "T" . $hour . ":" . $2 . ":00"; $fileSize =~ s/\,//g; # remove commas print " \n"; } } print "<\/rdf:RDF>\n";