copying a directory structure with a particular file in directories below
- From: "ROuNIN" <rounin.urashima@xxxxxxxxxxxxxx>
- Date: 14 Jun 2006 06:32:59 -0700
Hello,
I need some help/advise on how to copy a directory structure with a
particular file in directories below the start directory.
Let's say I have many text files [*.txt] with many data files and other
files [*.data, *.*]
The directory I want to copy across to another area with only the text
files but which also retains the directory structure.
i.e.,
[root_directory]
|__[data]
|__[directory_1]
|__[direcotry_2]
| |__[directory_2.1]
|
|__[directory_3]
|
|__[directory_N]
I want to copy the directory [data] to another area with just the *.txt
files but retain the directory structure.
I tried to do this
cp -r `find /[root_directory]/[data] -name "*.txt"` .
NOTE: The above when I include the square brackets is meant to
represent the full name of the
directory and is not to be confused with anything else.
I could have wrote:
cp -r `find /root_directory/data/ -name "*.txt"` .
When doing this, all I get is the *.txt files without the directory
structure. If the *.txt files have the same name it will cause
problems. So I can copy the directory structure it would be great.
I hope you can understand the issue/problem statement from my
explanation.
If you have any questions please ask me.
Thanks,
ROuNIN
.
- Follow-Ups:
- Re: copying a directory structure with a particular file in directories below
- From: dfeustel
- Re: copying a directory structure with a particular file in directories below
- From: Stephane Chazelas
- Re: copying a directory structure with a particular file in directories below
- Prev by Date: Re: rm -rf "/path/to/files/*.*" 2>&1 fails and throws no errors/warnings
- Next by Date: Re: copying a directory structure with a particular file in directories below
- Previous by thread: Script to report long running processes (> 4 hours)
- Next by thread: Re: copying a directory structure with a particular file in directories below
- Index(es):