The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Differentiate Soft and Hard Link balu_solaris UNIX for Dummies Questions & Answers 4 01-23-2009 05:18 PM
hard/soft link question Browser_ice UNIX for Dummies Questions & Answers 1 08-19-2006 03:13 AM
links.... soft or hard.. not sure? yls177 UNIX for Dummies Questions & Answers 5 10-25-2002 04:12 AM
links: (soft, hard? symbolic??) inode gusla UNIX for Dummies Questions & Answers 5 05-09-2002 09:58 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-13-2006
manthasirisha manthasirisha is offline
Registered User
  
 

Join Date: Jan 2006
Posts: 59
Exclamation using find to locate hard and soft links with tar

I am digging for certain types of files in the current directory and all its sub-directories and archiving them with the following code:

#! /usr/bin/ksh

Archive=`date +%Y_%m_%d_%T`
find . -type f \( -name \*\.ksh -o -name \*\.sql -o -name \*\.ini \) -print|xargs tar -cf configksh_$Archive.tar

rm -rf $Archive

The problem with this piece of code I have is that-- I can't locate the links (symbolic / hard / soft.. I'm not sure of the difference either) of the resultant files.

Can somebody throw light on how I can "find" all the links recursively within the current directory along with the files that are of the desired extensions as shown. (Links , obviously, needn't have these extensions).

Correct me if I'm wrong in saying:

find . \( -type f -o -type l \) \( -name \*\.ksh -o -name \*\.sql -o -name \*\.ini \) -print|xargs tar....

to do what I want.

Thanx to all who save me quickly,
Sirisha

Last edited by manthasirisha; 03-13-2006 at 10:39 AM.. Reason: Addition of a small comment
  #2 (permalink)  
Old 03-14-2006
manthasirisha manthasirisha is offline
Registered User
  
 

Join Date: Jan 2006
Posts: 59
C'mon ppl.. it's about 20 hrs and not a single reply?!

I'm really desperate to get this right as early as possible..
I understood from a lot of posts here that there is no direct way to find hard links...except with the help of inode number. For soft links the "l" predicate in the list of file permissions when issued a "ls -l".. may help..

but i just want to confirm if i'm thinking in the right direction.

Can files of the required extensions be identified along with their links(hard or soft) using find command? If so, please enlighten me how.

Thanks a ton in advance,
Sirisha

Last edited by manthasirisha; 03-14-2006 at 09:25 AM..
  #3 (permalink)  
Old 03-14-2006
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
Supporter
  
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,350
manthasirisha,

Please note that we are not obligated to reply to your posts. Everyone on this forum has a job as a sysadmin, or a programmer or are students and are helping out on the forums in their free time.

You have already used the find command with the type predicate. Use the same command:
Code:
find . -type l -exec ls -l {} \;
This find will list all files that are soft (symbolic) links. Is this what you want?
  #4 (permalink)  
Old 03-14-2006
manthasirisha manthasirisha is offline
Registered User
  
 

Join Date: Jan 2006
Posts: 59
Blowtorch,

I never did say anything like that.. nor even did I mean when was asking help for a second time. It was a very informal and casual expression I thought, could use to request our expert friends from such a hyooooooge group. It wasn't meant to obligate anyone here to respond to it all.. it's a just a plain and urgent request! Sorry, if you felt it personal.

Thanks a ton for your advice on that! But that's not all that I'm looking for. I need a short method by which I can extract the files I need and follow up both their hard and soft links.

Hope I made myself thorougly clear!

Sirisha
  #5 (permalink)  
Old 03-14-2006
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
  
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,628
If you are using GNU-find: use the "-follow" clause to dereference the links if this is what you want to do.

More on this could be found at "man find".

bakunin
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:48 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0