使用javascript确定文件夹中的文件数 [英] Determining number of files in folder using javascript

查看:77
本文介绍了使用javascript确定文件夹中的文件数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我想确定

文件夹中的图像文件数量,以便我可以相应地创建一个动态表格。为此我需要一种方法来识别文件夹中的文件数量。有没有

我可以估算这个,这样我就可以确定一个

数组的大小来创建我的桌子


问候

Prashant

解决方案

prashant在2007年12月23日上午11:18说了以下内容:


hello,

我想确定

文件夹中的图像文件数量,这样我就可以创建一个动态的相应的表。为此我需要一种方法来识别文件夹中的文件数量。



客户端JS无法做到这一点。它在任何服务器端语言中都是微不足道的。

虽然。


有什么办法我可以估计这个以便我可以确定

创建表格的数组大小



嗯?没有任何意义。


-

兰迪

机会有利于准备好的心灵

comp.lang.javascript常见问题 - http://jibbering.com/faq/index。 html

Javascript最佳实践 - http:// www.JavascriptToolbox.com/bestpractices/


12月23日,11:18 * am,prashant< b.prash ... @ gmail.comwrote :


hello,

* * * * *我希望确定图像文件的数量

文件夹,以便我可以相应地创建一个动态表。为此我需要一种方法来识别文件夹中的文件数量。有没有

我可以估算这个,这样我就可以确定一个

数组的大小来创建我的桌子


问候

Prashant



在Javascript中,你永远不必在使用

之前对数组进行维度。你可以这样做:


var imgs =抓取图像的一些代码

var imgArray = []; /创建一个空数组


for(var t = 0; t = imgs [t]; t ++)

imgArray.push(t);


并且您的阵列将被填充


st*****@gmail.com 说:


>

在Javascript中,你永远不必维度你使用之前的数组

吧。你可以这样做:


var imgs =抓取图像的一些代码

var imgArray = []; /创建一个空数组


for(var t = 0; t = imgs [t]; t ++)

imgArray.push(t);


你的数组将填充



嘿,谢谢你。我正在分配新元素:


imgArray [imgArray.length] = t;


我知道它效率低下,从未想过我想是使用推送。我现在感觉很闷气。


非常感谢!


~A!


hello,
I am looking to determine the number of image files in a
folder so that I could create a dynamic table accordingly. For this i
need a method to identify the number of files in a folder. Is there
any way i could estimate this so that i could determine the size of an
array to create my tables

regards
Prashant

解决方案

prashant said the following on 12/23/2007 11:18 AM:

hello,
I am looking to determine the number of image files in a
folder so that I could create a dynamic table accordingly. For this i
need a method to identify the number of files in a folder.

Client-side JS can''t do that. It is trivial in any server side language
though.

Is there any way i could estimate this so that i could determine
the size of an array to create my tables

Huh? Nothing in that makes any sense.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


On Dec 23, 11:18*am, prashant <b.prash...@gmail.comwrote:

hello,
* * * * * I am looking to determine the number of image files ina
folder so that I could create a dynamic table accordingly. For this i
need a method to identify the number of files in a folder. Is there
any way i could estimate this so that i could determine the size of an
array to create my tables

regards
Prashant

In Javascript, you never have to dimension an array before you use
it. You can just do something like this:

var imgs = some code that grabs the images
var imgArray = []; / create an empty array

for (var t=0; t=imgs[t]; t++)
imgArray.push(t);

and your array will be populated


st*****@gmail.com said:

>
In Javascript, you never have to dimension an array before you use
it. You can just do something like this:

var imgs = some code that grabs the images
var imgArray = []; / create an empty array

for (var t=0; t=imgs[t]; t++)
imgArray.push(t);

and your array will be populated

Hey, thanks for that. I was assigning new elements with:

imgArray[imgArray.length] = t;

I knew it was inefficient, just never thought to use push, I suppose. I
feel sully now.

Thanks a ton!

~A!


这篇关于使用javascript确定文件夹中的文件数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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