0

I have a directory structure

./
└── file1
   ├── config.xml
   ├── config.yml
   └── file2
       ├── config.xml
       ├── config.yml
       └── file3
           ├── config.xml
           └── config.yml

What i want is to copy same directory structure and everything but ignoring config.yml files in the new location Any Linux Command or script Thanks in advance

ricky
  • 471
  • 1
  • 5
  • 11

2 Answers2

0

As i understood you just want to replicate the folder structure,

You could do something like:

find . -type d >dirs.txt

to create the list of directories, then

xargs mkdir -p <dirs.txt

to create the directories on the destination.

Take a look at this https://stackoverflow.com/a/4073992/6916391

Community
  • 1
  • 1
permaban96
  • 13
  • 4
  • I want to replicate directory structure along with files in those directories ignoring few of them – ricky Apr 18 '17 at 06:29
0

You can do it in two steps by copying the whole structure and then removing the config.yml files, this is:

cp -R old_structure_parent_dir new_structure_parent_dir
find new_structure_parent_dir -name config.yml -exec rm -rf {} \;
Zumo de Vidrio
  • 2,021
  • 2
  • 15
  • 33