命令行将文件名打印到输出文件 [英] command line print file names to output file

查看:572
本文介绍了命令行将文件名打印到输出文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这在Linux中似乎很容易,但我想打印一个目录及其子目录中的* .pdf文件的名称到输出文件。我有Perl安装在我的Windows机器上。

解决方案

与Linux没有多少不同。

  dir * .pdf> fileyouwant.txt 

如果只需要文件名,可以使用

  dir / b * .pdf> fileyouwant.txt 

如果还需要子目录,

  dir / s / b * .pdf> fileyouwant.txt 

如果您不在该目录中开始

  dir / s / b C:\Path \ * .pdf> fileyouwant.txt 


This seems easy in Linux, but I'm trying to print the names of *.pdf files within a directory and its subdirectories to an output file. I have perl installed on my windows machine. What's a simple way to do this?

Thanks, Jake

解决方案

Not much different than Linux.

dir *.pdf > fileyouwant.txt

If you only want the filenames, you can do that with

dir/b *.pdf > fileyouwant.txt

If you also want subdirs,

dir/s/b *.pdf > fileyouwant.txt

If you aren't in that directory to start with

dir/s/b C:\Path\*.pdf > fileyouwant.txt

这篇关于命令行将文件名打印到输出文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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