查找命令行多个文件 [英] Find multiple files from the command line

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

问题描述

说明:

我寻找的文件非常大的服务器是不同的服务器上。现在,我打开命令提示符并键入

I am searching a very large server for files that is on a different server. right now I open command prompt and type

DIR [FILE NAME] /S/4

这将返回与是不是真的需要一些其他的东西文件的服务器位置。

This returns the server location of the file with some other stuff that is not really needed.

问:

我有很多的文件进行搜索并逐一输入到上面的命令可以永远走。有没有一种方法,我可以输入所有的所有文件的名称,只搜索一次,搜索结果将只需要显示文件名和位置?

I have a lot of files to search and one by one input into the above command could take forever. Is there a way I could input all of the names of all the files and only search once and the search results would only need to show file name and location?

推荐答案

首先,我希望大家不要吝啬DOS,而是视窗CMD或批处理。

First, I hope you don't mean DOS, but rather Windows cmd or batch.

您当然可以编写一个脚本,将每个文件运行一次您的DIR命令受到追捧。

You can certainly write a script that will run your DIR command once per file being sought.

但你很可能希望,而不是什么是搜索一次,打印找到的每个文件的路径。为此,您可以使用PowerShell的 FindChildItem 或改进的单张贴在这里:的http://windows-powershell-scripts.blogspot.in/2009/08/unix-linux-find-equivalent-in.html

But what you most likely want instead is to search once and print the path of each file found. For this you can use PowerShell's FindChildItem or the improved one posted here: http://windows-powershell-scripts.blogspot.in/2009/08/unix-linux-find-equivalent-in.html

这将是这样的:

Find-ChildItem -Name "firstfile.txt|secondfile.txt|..."

另一种方法是安装 MSYS 的cygwin 或用于Windows其他Linux工具环境和使用Linux 找到命令。

Another approach is to install msys or cygwin or another Linux tools environment for Windows and use the Linux find command.

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

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