################################################################ # # Read options from file # ################################################################ #Read options file $options = GetFile ("Options.txt"); #Extract options ($RootDir) = ( $options =~ /^website\s*=\s*(.*?)\n/mi); ($HtmlExtensions) = ( $options =~ /^HTML files\s*=\s*(.*?)\n/mi); ($GraphicsExtensions) = ( $options =~ /^Graphics files \s*=\s*(.*?)\n/mi); ($OutputPrefix) = ( $options =~ /^output prefix\s*=\s*(.*?)\n/mi); ($BaseURL) = ( $options =~ /^URL\s*=\s*(.*?)\n/mi); ($CalculateImageSizes) = ( $options =~ /^Show image sizes\s*=\s*(.*?)\n/mi); sub ScanSite() { $RootLen = length($RootDir); #Display folder name print "\nChecking website: $RootDir"; ################################################################ # # Open files # ################################################################ #Create a list of folders open (FOLDERS, "> ${OutputPrefix}Folders.txt") || die(); open (FILES, "> ${OutputPrefix}Files.txt") || die(); open (SUMMARY, "> ${OutputPrefix}Summary.htm") || die(); open (CATEGORIES, "> ${OutputPrefix}Categories.txt") || die(); open (LINKS, "> ${OutputPrefix}Links.txt") || die(); open (UNTITLED, "> ${OutputPrefix}UntitledFiles.txt")|| die(); open (STATS, "> ${OutputPrefix}Statistics.txt") || die(); open (IMAGES, "> ${OutputPrefix}Images.htm") || die(); print SUMMARY HTML_Header("Summary"); print CATEGORIES "#Number, title, sub-folder of\n\n"; print FILES "#URL, category, title, keywords\n\n"; print LINKS "#URL, Description\n\n"; print UNTITLED "The following files do not have any title:\n"; print IMAGES HTML_Header("Images from the website"); ################################################################ # # Initialise local variables # ################################################################ #Create a list of folders to index @Folders = ($RootDir); @ParentFolders = (-1); $ListedLinks = ""; $CountFiles=0; $CountFolders=0; $CountHTMLFiles=0; $CountGraphicsFiles=0; ################################################################ # # Scan folders # ################################################################ #Loop through folders while ($Folder = shift(@Folders)) { $CountFolders++; $ParentFolder = shift(@ParentFolders); #Get relative folder name $RelativeFolder = substr($Folder, $RootLen + 1 ); if ($Folder =~ /[\\\/](\w+)$/) { $FolderName = $1; } else { $FolderName = $RelativeFolder; } if ($FolderName eq "_notes") { next; } $Category++; #Write data to files print FOLDERS "\n$RelativeFolder"; print SUMMARY "\n
\n\t\n\t
\n\t$TrueFilename$ImageSizeText\n