获取文件夹中的文件列表 [英] Getting file list in a folder

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

问题描述

我创建了一个工具,可以从特定位置提取文件、复制、压缩,然后将其放在另一个位置.用户必须从该位置选择所需的文件夹.

I have created a tool which picks up a file from a specific location, copies it, zips it and then puts it at another location. The user has to select the required folders from the location.

有什么方法可以让我在工具中创建一个选项,以便用户可以看到该位置的可用文件夹列表,或者某种方式将用户直接定向到该位置?我只需要文件夹名称.

Is there any way through which I can create an option in the tool so that the user can see the list of available folders at that location, or some way to direct the user directly to that location? I only need the folder names.

我用 cmd 尝试过,但由于该位置不在我的计算机上(它在另一台具有共享属性的计算机上),我不知道如何访问该位置.非常感谢任何帮助,任何提示.我的工具是 VBScript 和 ASP.

I tried it with cmd but since the location is not on my computer (it's on another computer with shared property) I dunno how to access that location. Any help, any hint is very much appreciated. My tool is in VBScript and ASP.

推荐答案

您可以使用 FileSystemObject 获取目录的内容.

You can use a FileSystemObject to get the contents of a directory.

set fso = CreateObject( "FileSystemObject" )
set my_folder = fso.getFolder( "C:\Example" )

然后,使用 Folder 对象来获取其内容.

Then, use the Folder object to get its contents.

set sub_folders = my_folder.subFolders
for each f in sub_folders
  wscript.echo( f.name & VBNEWLINE )
next

这篇关于获取文件夹中的文件列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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