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

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

问题描述


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


I have a Textfile with one Filename per row:

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

(大约 200 个文件名)

(About 200 Filenames)

现在我想在文件夹中递归搜索此文件名,以获取 Filenames.txt 中每个文件名的完整路径.
这个怎么做?:)

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? :)

(目的:将文件复制到我的 MP3 播放器,但其中一些已损坏,我想重新复制它们,而不需要花费数小时从我的音乐文件夹中研究它们)

(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天全站免登陆