![](/img/trans.png)
[英]Showing only the content of a file from a directory(given as parameter ) or his subdirectories which has .txt extension, using grep
[英]I want to only the contents of directories and his subdirectories to a directory without copying the directory and subdirectory
輸入:-
我有一個目錄也包含子目錄,子目錄也包含一些這樣的數據。
測試/abc/def/file1.txt
測試/abc/file2.txt
測試/file3.txt
我需要像這樣的一個目錄中的所有文件
意味着我需要子目錄中的所有數據到一個文件夾
OUTPUT:-
test2/file1.txt
test2/file2.txt
test2/file3.txt
查找所有文件:
find source/ -type f
將多個文件復制到一個目錄:
cp -t target/ files...
結合兩個命令:
find source/ -type f -exec cp -t target/ '{}' +
利潤
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.