Checking if a file exist

B

batels

Hey All,
I'm a bit new at this,and i tryed seraching google about it but i
didn't quite got a solution.
I'm writing an HTML page that needs to check if another html file exist
(in the same folder) and if not,to call to a C file and create that
html file.
I tryed to do that with JavaScript but i understood there is no such
option.
Can u advice?
and once i know that file doesn't exist,can i call to a C file from a
simple html page?

Thanks a lot!
 
E

Evertjan.

wrote on 25 okt 2005 in comp.lang.javascript:

Not my name,
I'm a bit new at this,and i tryed seraching google about it but i
didn't quite got a solution.
I'm writing an HTML page that needs to check if another html file exist
(in the same folder) and if not,to call to a C file and create that
html file.
I tryed to do that with JavaScript but i understood there is no such
option.
Can u advice?

This is not sms, please use only usenet abbreviations.
and once i know that file doesn't exist,can i call to a C file from a
simple html page?
Thanks a lot!

[We didn't do anything yet, so why the thanks.]

If you are talking javascript in a browser on a page from a server on
internet, the js has no security clearance for files on the client.

Javascript on a local .hta file or in wscript is a different matter.

The same goes for serverside javascrpt [on an ASP platform]

Which of the 4 is your Q about?
 
D

David Dorward

I'm writing an HTML page that needs to check if another html file exist

HTML is a data format, it can't "do" anything.
(in the same folder) and if not,to call to a C file and create that
html file.

Call to a C file? Do you mean "execute a binary created by compiling
source C source code"?
I tryed to do that with JavaScript but i understood there is no such
option.

Client side JavaScript runs with very low permissions. Its almost
certainly the wrong tool for what you are doing.
Can u advice?

It sounds like you need to set up your webserver so that when a file is
requested, it checks to see if it exists, and if it doesn't, create the
file and then returns the result.

Apache is the industry standard webserver and certainly has this
capability. I'd get a copy of the Eagle book if I were you, it goes
over how to do this sort of thing. (It should be a fairly simple
content handler).

http://www.oreilly.com/catalog/wrapmod/
 
B

batels

Thanks for the quick response.
by calling to a C file , i did mean to execute a compiled source code.
i'm writing a program that generates these html pages,do i still need
to look at the Apache? I meen,i'm not creating a website or anything
like that...
 
E

Evertjan.

wrote on 25 okt 2005 in comp.lang.javascript:

[please always quote on usenet, this is not email]
Thanks for the quick response.
by calling to a C file , i did mean to execute a compiled source code.
i'm writing a program that generates these html pages,do i still need
to look at the Apache? I meen,i'm not creating a website or anything
like that...

Compiled sourcecode is not sourcecode anymore. You mean executable?

Please first answer my Q on what platform.
 
E

Evertjan.

wrote on 25 okt 2005 in comp.lang.javascript:
All local. JavaScript on a local html page

Sorry,
if you persist in using usenet as email by not quoting where you are
replying on, so that others cannot follow the read,
I will not anwer you anymore.
 
B

batels

I'm sorry! so please explain how to reply...it's my first time...
i just pressed on the link that says "response" ,so tell me,
what do i need to do to reply correctly?
 
E

Evertjan.

wrote on 25 okt 2005 in comp.lang.javascript:
I'm sorry! so please explain how to reply...it's my first time...
i just pressed on the link that says "response" ,so tell me,
what do i need to do to reply correctly?

It all depends on what news-reader you use
[xnews. agent, outlook]
or perhaps a web-news form, like Google groups.

You can easily educate yourself by looking at
other usenet postings and reading about usenet-netiquette.
 
R

Randy Webb

(e-mail address removed) said the following on 10/25/2005 10:35 AM:
This is my firt time here. i wasn't sure on how to reply.

Please quote what you are replying to.

If you want to post a followup via groups.google.com, don't use the
"Reply" link at the bottom of the article. Click on "show options" at
the top of the article, then click on the "Reply" at the bottom of the
article headers.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
 
B

batels

Compiled sourcecode is not sourcecode anymore. You mean executable? Yes,i meant executable.
Please first answer my Q on what platform.
Everything i use is local. I need to write an Html file (call it #1)
that
searches for a different html file (call it #2) that exist at them same
directory. if it exist it creates a link to in,and if not i should
execute a C file that will generate the #2 file.

My probem is - i don;'t know how to search for a file (tryed
JavaScript,didn't work) and how to execute a file from Html.

Thanks ! i hope i post it correctly this time.
 
B

batels

Compiled sourcecode is not sourcecode anymore. You mean executable?
Yes,i meant an executable file.
Please first answer my Q on what platform.

Everything i use is local. I need to search for html file #2
which is at the same library as html file #1.
if the html file #2 doesn;t exist,the html file #1 should excute a C
file
to create it.
Thanks,i hope i post is wright.
 
B

batels

Basically, I don't think Javascript is the right tool for solving your
problem. Unless there are other reasons why this *has* to be done in
Javascript, your best bet is to use a script running on the server written
in PHP or Perl or some such thing.

Thanks! it doesn't have to be JavaScript. I'll try to investigate
PHP,since
i'm not familiar with that.
Just one last thing,can i write a script in PHP that searches and
execute files
that are on my local pc and not saved on a server?
 
D

Dr John Stockton

JRS: In article <[email protected]>
, dated Tue, 25 Oct 2005 07:35:44, seen in (e-mail address removed) posted :
This is my firt time here. i wasn't sure on how to reply.

Before posting to a group, you should look round. There is a FAQ
posting three times a week, in two parts. Read both parts.

<FAQENTRY> To reply in Google, use Show Options then its Reply.
<FAQENTRY> For non-Web use, see the Microsoft newsgroups : *.jscript
 
T

Thomas 'PointedEars' Lahn

David said:
[...]
batels said:
Thanks! it doesn't have to be JavaScript. I'll try to investigate
PHP,since
i'm not familiar with that.
Just one last thing,can i write a script in PHP that searches and
execute files
that are on my local pc and not saved on a server?

No, you can't --- PHP scripts run on the server.

Rubbish. PHP is but a programming language, it can run both
client-side and server-side. And so is and does J(ava)Script.
- --
+- David Given --McQ-+ "I concluded from the beginning that this would be
| (e-mail address removed) | the end; and I am right, for it is not half over
| ([email protected]) | yet." --- Sir Boyle Roche
+- www.cowlark.com --+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFDX1Dff9E0noFvlzgRAvEHAKDUCYmW/g0gUjcvNYtJ++8G6PKyMgCaAybK
3apdjV9lr4WyMo4GgZYpdHM=
=QhYh
-----END PGP SIGNATURE-----

From someone with a (here discouraged) PGP signature one would expect such
basic knowledge. The signature itself is broken, though; it has to be
start with a line containing only "-- " to comply to Internet standards,
and it is recommended to keep it short (4 lines or less is quasi-standard).


PointedEars
 
J

Jenn M

From: Evertjan.
wrote on 25 okt 2005 in comp.lang.javascript:
Sorry,
if you persist in using usenet as email by not quoting where you are
replying on, so that others cannot follow the read,
I will not anwer you anymore.

Evertjan. I am startled by how rude you are.

Obviously this person is a newbie and is 1) appropriately asking for
advice 2) stating what he/she has already done to look into the problem
3) thanking the group for any assistance they may provide. Your response
on the phrasing of the "Q" was neither helpful nor friendly.

Why would you respond in such a nasty manner?

You stated: "This is not sms, please use only usenet abbreviations. " If
you persist in thinking that this newsgroup is only available through
old-school programs or quasi-usenet through Google that provide a proper
quoting method, then you are denying the repurposing of information on
the Internet. I am currently replying through a textbox at
http://www.developersdex.com. There is no quoting, just a textbox.
(technically, a textarea, since you seem to be hung up on
technicalities) You're right, this is not sms, but it's not really
usenet either anymore, when I'm getting the information from http and
replying through http.

Likewise, your "replace all crosses…" statement is useless, because this
web page does not show your email address at all. Should I consider you
as stupid for your ill-advised tagline instruction?

The phrase is: "If you can't say something productive, keep your
friggin' mouth shut."
With that in mind, I will productively tell you to please refrain from
bashing someone when they are simply looking for help. You are not
helping.

Thanks in advance, <-- certainly in advance, since your first post
snidely said, "[We didn't do anything yet, so why the thanks.]"
Apparently "common courtesy" is not in your usenet vocabulary.


Jenn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,099
Messages
2,570,626
Members
47,237
Latest member
David123

Latest Threads

Top