How to copy a tree of directory


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to copy a tree of directory
# 1  
Old 11-26-2010
How to copy a tree of directory

Mi question is how can you copy only de three of directory and not the files in it.

Only a need the three of directorys not the files
# 2  
Old 11-26-2010
Try:
Code:
find /source_dir -type d | xargs -i mkdir /destination_dir/{}

If you need the rights and ownership of those directories to be kept, then use:
Code:
find /source_dir -type d | cpio -puvm /destination_dir

# 3  
Old 11-26-2010
hELLO THANK you for your answer i copy the exit. It doesnt work any ideas?

e3000-10# find /prueba -type d | cpio -puvm /prueba2
cpio: Use -d option to copy "/prueba"
cpio: Use -d option to copy "/prueba/solux"
cpio: Use -d option to copy "/prueba/solux/ale"
cpio: Use -d option to copy "/prueba/solux/ale/ale1"
cpio: Use -d option to copy "/prueba/solux/ale/ale1/dark_raid"
cpio: Use -d option to copy "/prueba/solux/ale/ale1/dark_raid/Dark_Raid"
cpio: Use -d option to copy "/prueba/solux/ale/ale1/dark_raid/Dark_Raid/Counter-Strike"
cpio: Use -d option to copy "/prueba/solux/ale/ale1/dark_raid/Dark_Raid/Counter-Strike/cstrike"
cpio: Use -d option to copy "/prueba/solux/ale/ale1/dark_raid/Dark_Raid/Counter-Strike/cstrike/maps"
cpio: Use -d option to copy "/prueba/solux/ale/ale2"
cpio: Use -d option to copy "/prueba/solux/ale/ale2/SpriteE!!!!"
cpio: Use -d option to copy "/prueba/solux/ale/ale2/SpriteE!!!!/Hl LogoCreator por IgnacioxGold"
cpio: Use -d option to copy "/prueba/solux/ale/ale2/SpriteE!!!!/Hl LogoCreator por IgnacioxGold/hlc10"
cpio: Use -d option to copy "/prueba/solux/ale/ale3"
cpio: Use -d option to copy "/prueba/solux/ale/ale3/Winbspc"
cpio: Use -d option to copy "/prueba/solux/solux1"
cpio: Use -d option to copy "/prueba/solux/solux1/Construction Time Again"
cpio: Use -d option to copy "/prueba/solux/solux1/Construction Time Again/Construction Time Again"
cpio: Use -d option to copy "/prueba/solux/solux2"
cpio: Use -d option to copy "/prueba/solux/solux3"
cpio: Use -d option to copy "/prueba/solux2"
0 blocks
21 error(s)

e3000-10# ls prueba2
e3000-10#
# 4  
Old 11-26-2010
You are missing the -d option for cpio to create directories if needed...
# 5  
Old 11-26-2010
Code:
find /prueba -type d | cpio -pdumv /prueba2

# 6  
Old 11-29-2010
Yes but the -d option make that copy also the files inside the directory i only need the strcuture the tree. Thank you again
# 7  
Old 11-29-2010
I dont see how and I just tested... It will copy ONLY directories...
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Copy Directory Tree from one Server to Another

Hi, I have a serverA with Directory "/opt/app/myfiles" which is 8.5GB with more than 40000 files and 45 folders in it. I wish to transfer the folder "/opt/app/myfiles" tree structure with all the sub-directories and skip all files to another serverB. I would appreciate a command that... (4 Replies)
Discussion started by: mohtashims
4 Replies

2. Shell Programming and Scripting

Copy real file from a shortcut preserving the time stamps and directory tree

I have directory with shorcuts of files. for example: gara@yn\short\name1 ( shortcut to gara@yn\FOLDER\OPT\GARA\1.jpg ) gara@yn\short\name2 ( shortcut to gara@yn\FOLDER\OPT\GARA\11.jpg ) gara@yn\short\name3 ( shortcut to gara@yn\MARA\URSA\2.jpg ) gara@yn\short\name4 ( shortcut to... (6 Replies)
Discussion started by: gogok_bg
6 Replies

3. Shell Programming and Scripting

Specific directory parsing in a directory tree

Hi friends, Hello again :) i got stuck in problem. Is there any way to get a special directory from directory tree? Here is my problm.." Suppose i have one fix directory structure "/abc/xyz/pqr/"(this will be fix).Under this directory structure i have some other directory and... (6 Replies)
Discussion started by: harpal singh
6 Replies

4. UNIX for Dummies Questions & Answers

Copy directory tree with files

Iam in the process of copying a directory with thousands of directories and files into a new directory. I need to preserve permissions, owner, group, date and timestamps, everything. Iam using AIX and would need help of writing the command whether it is cp-RP or cpio. Apprecaite your... (3 Replies)
Discussion started by: baanprog
3 Replies

5. UNIX for Dummies Questions & Answers

directory tree with directory size

find . -type d -print 2>/dev/null|awk '!/\.$/ {for (i=1;i<NF;i++){d=length($i);if ( d < 5 && i != 1 )d=5;printf("%"d"s","|")}print "---"$NF}' FS='/' Can someone explain how this works..?? How can i add directory size to be listed in the above command's output..?? (1 Reply)
Discussion started by: vikram3.r
1 Replies

6. UNIX for Dummies Questions & Answers

Move all files in a directory tree to a signal directory?

Is this possible? Let me know If I need specify further on what I am trying to do- I just want to spare you the boring details of my personal file management. Thanks in advance- Brian- (2 Replies)
Discussion started by: briandanielz
2 Replies

7. Shell Programming and Scripting

Recursively copy only specific files from a directory tree

Hi I am a shell-script newbie and am looking to synchronize certain files in two directory structures. Both these directory-trees are in CVS and so I dont want the CVS directory to be copied over. I want only .sh and .pl files in each subdirectory under these directory trees to be... (3 Replies)
Discussion started by: sharpsharkrocks
3 Replies

8. Shell Programming and Scripting

Read from fileList.txt, copy files from directory tree

Hi, hopefully this is a fairly simple Q&A. I have a clean file list of approximately 180 filenames with no directory or slashes in front of the filename nor any extension or dot ".". I would like to read from this list, find these files recursively down through directory trees, copy the files... (1 Reply)
Discussion started by: fxvisions
1 Replies

9. HP-UX

Not able to copy the tree node text in HP UX, while easily done in window

I m not able to copy the text present on the tree's node to terminal or other text editor in solaris. I m using <Shift><control> C and V comaand for the same but the text is not being copied and pasted on the text pad or the terminal window. While the same is possible in windows OS using ctrl+c... (2 Replies)
Discussion started by: friendanoop
2 Replies

10. Solaris

Not able to copy the tree node text in solaris, while easily done in window

I m not able to copy the text present on the tree's node to terminal or other text editor in solaris. I m using <Shift><control> C and V comaand for the same but the text is not being copied and pasted on the text pad or the terminal window. While the same is possible in windows OS using ctrl+c... (3 Replies)
Discussion started by: friendanoop
3 Replies
Login or Register to Ask a Question