Linux:以递归方式查找字典中的文件列表 [英] Linux: Find a List of Files in a Dictionary recursively

查看:505
本文介绍了Linux:以递归方式查找字典中的文件列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有一个每行一个文件名的文本文件:

 解释1  - 歌曲1 .mp3 
Interpret 2 - Song 2.mp3
...

(大约200个文件名)

现在,我要为文件名重复搜索一个文件夹,以获取Filenames.txt中每个文件名的完整路径。 b如何做到这一点? :)目的:复制文件到我的MP3播放器,但其中一些是坏的,我想重新复制他们所有,而不用花费我的音乐研究他们的小时文件夹)

解决方案

最简单的方法可能是:

  cat orig_filenames.txt |同时读取文件;找到/目录/目录名称$文件;完成> output_file_with_paths 



I have a Textfile with one Filename per row:

Interpret 1 - Song 1.mp3
Interpret 2 - Song 2.mp3
...   

(About 200 Filenames)

Now I want to search a Folder recursivly for this Filenames to get the full path for each Filename in Filenames.txt.
How to do this? :)

(Purpose: Copied files to my MP3-Player but some of them are broken and i want to recopy them all without spending hours of researching them out of my music folder)

解决方案

The easiest way may be the following:

cat orig_filenames.txt | while read file ; do find /dest/directory -name "$file" ; done > output_file_with_paths 

这篇关于Linux:以递归方式查找字典中的文件列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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