簡體   English   中英

我只想將目錄及其子目錄的內容復制到一個目錄而不復制目錄和子目錄

[英]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

  1. 查找所有文件:

     find source/ -type f
  2. 將多個文件復制到一個目錄:

     cp -t target/ files...
  3. 結合兩個命令:

     find source/ -type f -exec cp -t target/ '{}' +
  4. 利潤

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM