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

Hooobi

Golden Member
Jan 26, 2001
1,217
0
76
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
 

yllus

Elite Member & Lifer
Aug 20, 2000
20,577
432
126
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.
 

nord1899

Platinum Member
Jun 18, 2001
2,444
0
0
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.
 

Hooobi

Golden Member
Jan 26, 2001
1,217
0
76
well... the programming is beyond me

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

any other ideas?
 

Armitage

Banned
Feb 23, 2001
8,086
0
0
enscript [options] *.html

source code for html???
Unless the html is generated by some program, the html is it.
 

nord1899

Platinum Member
Jun 18, 2001
2,444
0
0
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.
 

Cenalian

Senior member
Jul 3, 2001
681
0
0
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!
 

Rias

Member
Aug 23, 2002
101
0
0
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
 

Hooobi

Golden Member
Jan 26, 2001
1,217
0
76
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

 

nord1899

Platinum Member
Jun 18, 2001
2,444
0
0
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.
 

The Dancing Peacock

Diamond Member
Dec 22, 1999
3,385
0
0
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
 

Hooobi

Golden Member
Jan 26, 2001
1,217
0
76
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
 

Armitage

Banned
Feb 23, 2001
8,086
0
0
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.

 

jamesave

Golden Member
Aug 27, 2000
1,610
0
76
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
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |