Hedef dizin yapısını yinelenen görmezden gelen dosyayı nasıl kopyalayabilirim?


3

Kaynak dizinde aşağıdaki içeriğe sahibim:

source/foo.txt
source/bar/another_file.txt
source/bar2/and_another.txt

Bu dosyaları kopyaladıktan sonra şöyle görünecek bir hedef dizine kopyalamak istiyorum:

destination/foo.txt
destination/another_file.txt
destination/and_another.txt

Bunu nasıl yapabilirim? Öyle görünüyor ki "cp" böyle bir seçeneğe sahip değil

Yanıtlar:


3

Kullanım finddosyaları bulmak için, ve cponları kopyalamak için.

find source/ -type f -exec cp -t destination/ {} +
Sitemizi kullandığınızda şunları okuyup anladığınızı kabul etmiş olursunuz: Çerez Politikası ve Gizlilik Politikası.
Licensed under cc by-sa 3.0 with attribution required.