获取文件名和路径的列表
我有一个包含几个子目录的目录,我试图获取文件名及其路径的列表,然后我想在 Excel 中获取这些数据。有没有办法在 Windows 7 中使用命令行来执行此操作?
所需的 Excel 结果:
A1: FILENAME.JPG B1: X:\DIR1\DIR2\FIELNAME.JPG
I have a directory with several sub-directories and I am trying to get a list of the file names and their path, and then I would like to have this data in Excel. Is there a way I can do this with the command line in Windows 7?
Desired Excel result:
A1: FILENAME.JPG B1: X:\DIR1\DIR2\FIELNAME.JPG
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这将在名为 foo 的目录中生成以下内容,其中包含文件 a、b 和 c:
因此只需将输出通过管道传输到文件,然后将其导入到 Excel 中。您必须在 Excel 中进行一些操作才能将行分成两列而不是行,但这应该不难。
要正确地通过管道传输,您需要记住对 dir 命令进行管道传输并附加到文件,如下所示:
That will produce the following in a directory named foo with files a, b and c:
So just pipe the output to a file then import that into Excel. You'll have to do some manipulations in Excel to get the lines into two columns instead of rows, but that shouldn't be difficult.
To pipe it correctly, you need to remember to pipe both dir commands and append to the file, like this: