用于检索驱动器中所有文件名的程序 [英] Program to retrieve all filenames in drive
问题描述
大家好,
我需要一个简短的程序:
给定一个驱动器号,它将递归搜索所有目录,
生成它遇到的每个文件名(需要将每个文件名传递给
一个函数)。
不能不这么认为这个实用程序已经存在,但如果我能找到
就可以了。
任何帮助都将不胜感激。提前致谢
Hi all,
I have a need for a short program:
Given a drive letter, it would recursively search through all directories,
"generating" each filename that it encounters (need to pass each filename to
a function).
Can''t help but think this "utility" already exists but f**ked if I can find
it.
Any help would be greatly appreciated. Thanks in advance
推荐答案
" kevin.watters" <柯****** @ hotmail.com> écritdansle message de
news:s9 ******************** @ news20.bellglobal.com。 ..
"kevin.watters" <ke******@hotmail.com> a écrit dans le message de
news:s9********************@news20.bellglobal.com. ..
大家好,
我需要一个简短的程序:
给定一个驱动器号,它会递归搜索所有目录,
生成它遇到的每个文件名(需要将每个文件名
传递给一个函数)。
不能不认为这个实用程序已经存在,但是如果我可以
找到它的话。
任何帮助将不胜感激。提前致谢
Hi all,
I have a need for a short program:
Given a drive letter, it would recursively search through all directories,
"generating" each filename that it encounters (need to pass each filename to a function).
Can''t help but think this "utility" already exists but f**ked if I can find it.
Any help would be greatly appreciated. Thanks in advance
这与C语言凯文没有任何关系。你不在话题。
但无论如何它是:
DIR C:\ / B / S / AA> tmpfile
tmpfile将包含驱动器中的所有文件。
This has nothing to do with the C language kevin. You are off topic.
But anyway here it is:
DIR C:\ /B /S /AA >tmpfile
tmpfile will contain all files in the drive.
感谢Jacob的快速回复,我想我应该更清楚..
这个程序必须驻留在软盘上,并且无法以任何方式改变用户机器,因此存储tmpfile是一个问题( 68000个文件,它是
5M)。
我需要一些可以动态使用的东西,也就是说,不需要存储
文件名。我在VBScript中写了一些东西,称为C函数68000
次,耗时6.5小时,所以没有好处。
希望这会让事情更加清晰,谢谢再次。
凯文
" jacob navia" < JA *** @ jacob.remcomp.fr>在消息中写道
news:cd ********** @ news-reader4.wanadoo.fr ...
Thanks for the prompt reply Jacob, I guess I should be clearer..
This program has to reside on a floppy, and cannot alter the user machine in
any way, so the storing of the tmpfile is a problem (with 68000 files, it is
5M).
I need something that can be used "on the fly", that is, without storing the
filenames. I wrote something in VBScript, called the C function 68000
times, took 6.5 hours, so no good :)
Hope this makes things clearer, and thanks again.
Kevin
"jacob navia" <ja***@jacob.remcomp.fr> wrote in message
news:cd**********@news-reader4.wanadoo.fr...
" kevin .watters" <柯****** @ hotmail.com> écritdansle message de
新闻:s9 ******************** @ news20.bellglobal.com。 ..
"kevin.watters" <ke******@hotmail.com> a écrit dans le message de
news:s9********************@news20.bellglobal.com. ..
大家好,
我需要一个简短的程序:
给一个驱动器号,它将递归搜索所有
目录,生成它遇到的每个文件名(需要将每个
Hi all,
I have a need for a short program:
Given a drive letter, it would recursively search through all directories, "generating" each filename that it encounters (need to pass each
文件名传递给
filename to
一个函数)。
不能不考虑这个效用"已经存在,但如果我可以
a function).
Can''t help but think this "utility" already exists but f**ked if I can
找到
它。
任何帮助将不胜感激。提前致谢
it.
Any help would be greatly appreciated. Thanks in advance
这与C语言凯文没有任何关系。你不在话题。
但无论如何它是:
DIR C:\ / B / S / AA> tmpfile
tmpfile将包含所有文件在驱动器中。
This has nothing to do with the C language kevin. You are off topic.
But anyway here it is:
DIR C:\ /B /S /AA >tmpfile
tmpfile will contain all files in the drive.
" kevin.watters" <柯****** @ hotmail.com>在消息中写道
"kevin.watters" <ke******@hotmail.com> wrote in message
我需要一个简短的程序:
给一个驱动器号,它会递归搜索所有目录,
" ;产生"它遇到的每个文件名(需要将每个文件名传递给一个函数)。
I have a need for a short program:
Given a drive letter, it would recursively search through all directories,
"generating" each filename that it encounters (need to pass each filename
to a function).
不幸的是你不能在ANSI C中这样做。没有目录 ;
功能。这很糟糕,我不知道理由是什么。
然而肯定会有一个readdir。或类似的功能
您使用的平台可以实现您想要实现的目标。
Unfortunately you can''t do this in ANSI C. There are no "directory"
functions. This is pretty bad and I don''t know what the justification is.
However there will certainly be a "readdir" or similar function specific to
the platform you use which accomplishes what you are trying to achieve.
这篇关于用于检索驱动器中所有文件名的程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!