在 linux 系統(tǒng)中,cp -r 命令常用于遞歸復(fù)制目錄以及其內(nèi)部的所有文件
find /path/to/source -type d -exec cp -r {} /path/to/destination ;
該命令的具體含義如下:
- find /path/to/source:從指定的源目錄位置開(kāi)始搜索。
- -type d:僅匹配目錄項(xiàng)。
- -exec:為每個(gè)找到的目錄執(zhí)行后續(xù)的命令。
- cp -r {} /path/to/destination:將當(dāng)前目錄(表示為 {})以遞歸方式復(fù)制到目標(biāo)位置。
- ;:標(biāo)識(shí)-exec 參數(shù)的結(jié)束。
請(qǐng)注意替換命令中的 /path/to/source 和 /path/to/destination 為實(shí)際使用的路徑。
? 版權(quán)聲明
文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載。
THE END