• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

If I have 500+ html files and want to print the source code for them all... what's the easiest way?

Hooobi

Golden Member
I need the source code from a large number of html files. Does anyone know of a way to do this in some type of batch process?

Thanks

H
 
1. Put all of those HTML files in one directory.
2. Write a short program in your favourite programming language to go through each file in that directory and add them to one big textfile.
3. Print big textfile.
 
If the files have headers on them so you know where one ends and one stops, you could do this:

In a command prompt window:
type *.html > allhtml.txt

Then just open allhtml.txt and print.
The negative aspect is that they will all be merged together with no pagebreaks and no other way to tell where one starts/stops. Unless of course you have headers/footers or some other built in notification.


If you need more, I'm sure notfred can whip up some perl script to do it better.
 
well... the programming is beyond me

i tried the second suggestion but just got "bad command" or something like that

any other ideas?
 
You tried "type *.html > allhtml.txt"?

Maybe you didn't include the "type" part which is an actual command in DOS. Also, all the HTML files will need to be in the same directory for this.
 
If your using windows, put them all in one directory, highlight them all, right click and click Print.

If your using *nix, then I don't have any suggestions, sry.

GL!
 
If your using *nix, then I don't have any suggestions, sry.

for i in *.html; do a2ps $i; done

a2ps would likely call a browser to print the document so you would have to find a way to force it to print it as text
🙂
 
Originally posted by: nord1899
You tried "type *.html > allhtml.txt"?

Maybe you didn't include the "type" part which is an actual command in DOS. Also, all the HTML files will need to be in the same directory for this.

well... at least now that I'm including "type", it has now upgraded me to "file not found", although it will create a blank allhtml.txt file.

i've checked to make sure that all the files are there and that they're all .html

 
Originally posted by: Hooobi
Originally posted by: nord1899
You tried "type *.html > allhtml.txt"?

Maybe you didn't include the "type" part which is an actual command in DOS. Also, all the HTML files will need to be in the same directory for this.

well... at least now that I'm including "type", it has now upgraded me to "file not found", although it will create a blank allhtml.txt file.

i've checked to make sure that all the files are there and that they're all .html

I just tested the line on my machine to make sure I wasn't being stupid. It works. Just make sure all the HTML files are in that directory you do the command from.

So open a Command Prompt. Change to the directory with all the HTML files in it. Execute "type *.html > allhtml.txt". Open up "allhtml.txt" and print.
 
Originally posted by: Rias
If your using *nix, then I don't have any suggestions, sry.

for i in *.html; do a2ps $i; done

a2ps would likely call a browser to print the document so you would have to find a way to force it to print it as text
🙂

If it's *nix, a simple foreach loop with all the files in the same directory would suffice

foreach $f (`ls -1`) if there's more than just .htm or .html files then use this instead: (`ls -1 | egrep '*.htm(l)?'`)
foreach? lpr -P<printername> $file
foreach? end
 
yes, they're html, and yes i'm using the "*"

the only thing i may be doing different is spacing b/w each of the elements in the dos command

the program actually seems to work fine so i think i'll probably use that for now...

thanks for the help

H
 
Originally posted by: The Dancing Peacock
Originally posted by: Rias
If your using *nix, then I don't have any suggestions, sry.

for i in *.html; do a2ps $i; done

a2ps would likely call a browser to print the document so you would have to find a way to force it to print it as text
🙂

If it's *nix, a simple foreach loop with all the files in the same directory would suffice

foreach $f (`ls -1`) if there's more than just .htm or .html files then use this instead: (`ls -1 | egrep '*.htm(l)?'`)
foreach? lpr -P<printername> $file
foreach? end


Why do you need a loop? Just wildcard it.
And check out enscript ... a ton of options to do cool stuff like print double-sided, 2 pages per side in landscape mode, code highlighting, etc., etc.

 
Originally posted by: The Dancing Peacock
Originally posted by: Rias
If your using *nix, then I don't have any suggestions, sry.

for i in *.html; do a2ps $i; done

a2ps would likely call a browser to print the document so you would have to find a way to force it to print it as text
🙂

If it's *nix, a simple foreach loop with all the files in the same directory would suffice

foreach $f (`ls -1`) if there's more than just .htm or .html files then use this instead: (`ls -1 | egrep '*.htm(l)?'`)
foreach? lpr -P<printername> $file
foreach? end



Actually in *nix it should be easier with

> cat *.html >> files.html
> lpr -P <printername> files.html

No need foreach statement
 
Back
Top