which cmde recommended to copy an entire dty?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers which cmde recommended to copy an entire dty?
# 1  
Old 10-12-2004
which cmde recommended to copy an entire dty?

Hi,

- i am not unix specialist and i would like to save all the contents of a directory containing symbolic links BUT:

+ i want to get the links within the copy (to be able to restaor them)
+ i dont want to copy the directories which are pointed to by theses links

some advice?
what utility recommended (cp, cpio, tar) ?
thanks for help
Jakez
# 2  
Old 10-12-2004
cpio will preserve the symbolic links (and pretty much everything else you'd want).

In it's simplest form

find /some/input/dir -print | cpio -ov | gzip > output.cpio.gz

Will create a gzipped cpio archive of /some/input/dir and it's subdirectories and links, without archiving whatever the link points to.

You can skip the last pipe if you don't want the archive gzipped.

Cheers
ZB
# 3  
Old 10-12-2004
thanks a lot ZB
- by the way is it possible to do the same using cp or tar utility?
Jakez
# 4  
Old 10-12-2004
Hmm... well you could use cp -Rp to recursively copy (and preserve modification dates/times,etc) and preserve the link. But this wouldn't "archive" the files - it'd literally take a copy much like cpio in pass-through mode.

Tar would work pretty much the same as the cpio example,
tar cvf foo.tar /dir/to/tar
this'd preserve the link too.

So all three utilities would serve the purpose you require, but I'd use tar or cpio for backups/restores - cp isn't the tool for the job here.

Cheers
ZB
# 5  
Old 10-12-2004
- many thanks ZB
- i am going to use cpio or tar to make my saves
Jakez
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Copy entire file to a new file in awk

Hi, How do we write the contents of multiple files created in awk body to a new file in awk (END block) ? when I used "getline", it is consuming more time. Do we have any other way other than getline? (1 Reply)
Discussion started by: Cool
1 Replies

2. OS X (Apple)

Copy entire line in bash (terminal) - keyboard shortcut

how can I do that? I can paste a line with ctrl+p; but I dont know how to copy it? ctrl+y - just deletes etc. (2 Replies)
Discussion started by: c_lady
2 Replies

3. Shell Programming and Scripting

Copy an entire file to specific position to another file

Hi , I need your kind help for my below requirement I need to copy and entire txt file to a certain position to the target file . Source file has 3 lines and it has to be copied to the target file in position from line 10 to 12. Thanks for your support (1 Reply)
Discussion started by: Pratik4891
1 Replies

4. UNIX for Dummies Questions & Answers

Copy entire contents of file to clipboard

Hi, I am trying to figure out how to copy the contents of a file to the clipboard, then paste into a command. i.e copy contents of file /path/filename.txt to <command> <paste text> Hope that makes sense. Basically tryting to copy the text for use in a command without having to open the... (8 Replies)
Discussion started by: JCA70
8 Replies

5. UNIX for Dummies Questions & Answers

How to copy entire file content into another file being in last line mode of vi ?

How to copy entire file content into another file being in last line mode of vi ? ---------- Post updated at 10:07 AM ---------- Previous update was at 09:56 AM ---------- Got it : :1,30w file.txt (1 Reply)
Discussion started by: presul
1 Replies

6. SCO

Make a Copy Entire Hard Disk

Dear All, I have a standalone desktop with SCO Openserver V 5, this is used to control a machine with custom written software. The problem is that the machine manufacturer has closed shop (bankruptcy) and there is no support on software. As a precaution I would want to make a complete backup of... (3 Replies)
Discussion started by: iqbal_siddiqui
3 Replies

7. UNIX for Dummies Questions & Answers

Search for a string and copy the entire line

Hello All, I am after the script or the command which can scan the entire file for a string $PART_ID and when found to extract/copy the corresponding $PART_ID value (e.g THIRE_PTY_SOFTWARE for the 1st occurance of $PART_ID in the attached file) to a file. Appreciate your help. Thanks in... (3 Replies)
Discussion started by: forumthreads
3 Replies

8. UNIX for Dummies Questions & Answers

Copy and entire folder except one

Hi, I have a folder named "A". I want to copy the entire stuff inside it to another location except the folder "B" which is present inside it. How can it be done? (6 Replies)
Discussion started by: vibhor_agarwali
6 Replies

9. Linux

Copy entire disk in FC3

I'm running FC3 and I'd like to copy the entire /dev/hda to /dev/hdc, including all the boot info, so that I can boot off of it in case of failure. This will be a one time thing. I'm doing an app upgrade and I'm very afraid the install will go wrong, so I want to be able to quickly be back up in... (11 Replies)
Discussion started by: dangral
11 Replies

10. Solaris

cp a dty without symbolic links?

Hi, - we have copy (cp command) to do to save all the contents of a dty BUT we dont want to copy the files corresponding to symbolic links contained whithin this dty - the box is a sun solaris one - and the cp commande do not say avything about that? thanks for help Jakez (7 Replies)
Discussion started by: JAKEZ
7 Replies
Login or Register to Ask a Question