I have a directory structure as below:
source-dir---
|----- file-1
|----- file-2
|----- file-3
|----- folder-1
|---- file-4
|---- file-5
I want to copy all the files from the source directory to destination directory and maintain the same folder structure but I want to avoid copying the file-5
from its sub-directory.
Expecting the destination directory to be as follow:
destination-dir---
|----- file-1
|----- file-2
|----- file-3
|----- folder-1
|---- file-4
Is it possible to achieve above behaviour using cp
command itself? or rsync
or any specific regex using find
command?
file-5
only occur infolder-1
, or can a file of the same name appear in other parts of the directory tree as well? – AdminBee May 20 '21 at 07:32