检查文件是否存在 [英] Checking if a file exist

查看:68
本文介绍了检查文件是否存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿所有,

我在这方面有点新鲜,我试着搜索关于它的谷歌但是我没有得到解决方案。
我正在编写一个HTML页面,需要检查是否存在另一个html文件

(在同一文件夹中),如果没有,则调用C文件并创建那个

html文件。

我试着用JavaScript做到这一点,但我知道没有这样的

选项。

你可以建议吗?

一旦我知道该文件不存在,我可以从

简单的html页面调用C文件吗?


非常感谢!

解决方案

写于25 okt 2005 in comp.lang.javascript < b>

嘿所有,


不是我的名字,

我在这里有点新鲜,我试着搜索关于它的谷歌,但我还没有找到解决方案。
我正在写一个HTML页面,需要检查是否存在另一个html文件
(在同一文件夹中)如果没有,则调用C文件并创建该
html文件。
我尝试用JavaScript做到这一点但我明白没有这样的选项。
你可以建议吗?


这不是短信,请只使用usenet缩写。

一旦我知道该文件不存在,我可以调用C文件来自一个简单的HTML页面?
非常感谢!




[我们还没有做任何事情,所以为什么要感谢。]


如果你在浏览器上的一个浏览器上用javascript
internet来讨论javascript,js对客户端上的文件没有安全许可。


本地.hta文件或wscript中的Javascript是另一回事。


服务器端javascrpt [在ASP平台上]同样如此


你的Q中有4个是哪一个?


-

Evertjan。

荷兰。

(用我的电子邮件地址替换所有带点的十字架)


ba **** @ gmail.com 写道:

我正在编写一个HTML页面,需要检查是否存在另一个html文件


HTML是一种数据格式,它不能做。什么。

(在同一文件夹中),如果没有,调用C文件并创建该
html文件。


调用C文件?你的意思是执行通过编译创建的二进制文件

源代码C源代码??

我试着用JavaScript做到这一点但是我明白没有这样的
选项。


客户端JavaScript以非常低的权限运行。几乎

肯定是你正在做的错误工具。

你可以建议吗?




听起来就像你需要设置你的网络服务器一样,当一个文件被请求时,它会检查它是否存在,如果它不存在,那就创建

文件,然后返回结果。


Apache是​​行业标准的网络服务器,当然有这个

的能力。如果我是你,我会得到一本鹰书的副本,对于如何做这类事情,我会得到b
。 (它应该是一个相当简单的

内容处理程序)。

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


您可以使用ActiveX脚本对象,但我不推荐它!


搜索:


ActiveXObject(" Scripting.FileSystemObject")


IE虽然......


Evertjan。 <前************** @ interxnl.net>在消息中写道

news:Xn ******************** @ 194.109.133.242 ...

写道在25 okt 2005 in comp.lang.javascript

嘿All,



不是我的名字,
< blockquote class =post_quotes>我在这方面有点新鲜,我试着搜索关于它的谷歌但是我没有完全找到解决方案。
我正在写一个HTML页面需要检查是否存在另一个html文件
(在同一文件夹中),如果没有,则调用C文件并创建该
html文件。
我尝试用JavaScript执行此操作但是我明白没有这样的选择。


你可以建议吗?



这不是短信,请只使用usenet缩写。

一旦我知道该文件不存在,我可以从一个简单的html页面调用一个C文件吗?

非常感谢!

[我们还没有做任何事情,所以为什么要感谢。]

如果你在浏览器上的一个浏览器上谈论javascript <互联网,js对客户端上的文件没有安全许可。

本地.hta文件或wscript中的Javascript是另一回事。

相同适用于服务器端javascrpt [在ASP平台上]

你的Q中有哪四个是关于它的?

- Evertjan。
荷兰。
(用我的电子邮件中的点替换所有十字架)



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!

解决方案

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

Hey All,
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?

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)


ba****@gmail.com wrote:

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/


You could use the ActiveX scripting object, but I don''t recomend it!

do a search on:

ActiveXObject("Scripting.FileSystemObject")

IE only though...

"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.242...

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

Hey All,



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?

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)



这篇关于检查文件是否存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆