Sponsored Content
Top Forums Shell Programming and Scripting using find to locate hard and soft links with tar Post 101793 by manthasirisha on Monday 13th of March 2006 08:57:05 AM
Old 03-13-2006
Error 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
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

links: (soft, hard? symbolic??) inode

Hi, what is link? and soft link? how about hard one and symbolic link. and inode. i get confuse about this links. could anyone help me with full explainsion? thks Gusla (5 Replies)
Discussion started by: gusla
5 Replies

2. UNIX for Dummies Questions & Answers

links.... soft or hard.. not sure?

hi, i am in a directory, have 2 files as below then do a ls -l gives the below lrwxrwxrwx 1 root system 23 Mar 08 2001 filea -> /adir/filea lrwxrwxrwx 1 root system 23 Mar 08 2001 filea -> /adir/fileb now, when i do a cd /adir, the system said, adir not... (5 Replies)
Discussion started by: yls177
5 Replies

3. UNIX for Dummies Questions & Answers

Command to find all soft links in a directory

I need the command to find all soft links in a directory. Can someone please help. Thank you. (2 Replies)
Discussion started by: jgeo01
2 Replies

4. Programming

creating soft links

i'm trying to write a c code to copy a soft link over to a specified directory. Is it possible to do this without using symlink()? if so, what can I use? Thanks! (2 Replies)
Discussion started by: l flipboi l
2 Replies

5. Solaris

Hard Links and Soft or Sym links

When loooking at files in a directory using ls, how can I tell if I have a hard link or soft link? (11 Replies)
Discussion started by: Harleyrci
11 Replies

6. AIX

List all the soft links and hard links

Hi I'm logged in as root in an aix box Which command will list all the soft links and hard links present in the server ? (2 Replies)
Discussion started by: newtoaixos
2 Replies

7. UNIX for Dummies Questions & Answers

Simple example for soft and hard links

Hai, give me a simple example for soft and hard links. this will work for soft link ?? ln -s (2 Replies)
Discussion started by: Ramesh M
2 Replies

8. Shell Programming and Scripting

Create tar file excluding all hard links

I have a problem with tar. Taring a folder with a lot of contents, causes the tar to contain hard links to some files, seen with the same name but 0 in size. The hard links don't exist in the first place. How can I prevent that from happening? I am using the -T option with either -n or... (2 Replies)
Discussion started by: Tribe
2 Replies

9. Shell Programming and Scripting

Timestamp change for hard and soft links

Hi team, i am writing a purge script to delete softlinks and hardlinks on linux system which are 3/10/30 days old. To test the script i need to create links with old timestamp, i am able to cange timestamp for files but not for links. i tried touch -h option but this option is not available on... (1 Reply)
Discussion started by: Satyak
1 Replies

10. UNIX for Dummies Questions & Answers

Soft links question

Hello. I have some main directories. For example : /main_dir1 /main_dir2In main_dir2, I have a sub dir named sub_dir2-1 with 2 files in it ( file_2-1, file_2-2 ) /main_dir2sub_dir2-1file_2-1 file_2-2From "/main_dir1/A/B/C" I make a soft link ln -s /main_dir2/sub_dir2-1 ... (6 Replies)
Discussion started by: jcdole
6 Replies
TAP::Harness::Archive(3pm)				User Contributed Perl Documentation				TAP::Harness::Archive(3pm)

NAME
TAP::Harness::Archive - Create an archive of TAP test results SYNOPSIS
use TAP::Harness::Archive; my $harness = TAP::Harness::Archive->new(\%args); $harness->runtests(@tests); DESCRIPTION
This module is a direct subclass of TAP::Harness and behaves in exactly the same way except for one detail. In addition to outputting a running progress of the tests and an ending summary it can also capture all of the raw TAP from the individual test files or streams into an archive file (".tar" or ".tar.gz"). METHODS
All methods are exactly the same as our base TAP::Harness except for the following. new In addition to the options that TAP::Harness allow to this method, we also allow the following: archive This is the name of the archive file to generate. We use Archive::Tar in the background so we only support ".tar" and ".tar.gz" archive file formats. This can optionally be an existing directory that will have the TAP archive's contents deposited therein without any file archiving (no Archive::Tar involved). extra_files This is an array reference to extra files that you want to include in the TAP archive but which are not TAP files themselves. This is useful if you want to include some log files that contain useful information about the test run. extra_properties This is a hash reference of extra properties that you've collected during your test run. Some things you might want to include are the Perl version, the system's architecture, the operating system, etc. runtests Takes the same arguments as TAP::Harness's version and returns the same thing (a TAP::Parser::Aggregator object). The only difference is that in addition to the normal test running and progress output we also create the TAP Archive when it's all done. aggregator_from_archive This class method will return a TAP::Parser::Aggregator object when given a TAP Archive to open and parse. It's pretty much the reverse of creating a TAP Archive from using "new" and "runtests". It takes a hash of arguments which are as follows: archive The path to the archive file. This can also be a directory if you created the archive as a directory. This is required. parser_callbacks This is a hash ref containing callbacks for the TAP::Parser objects that are created while parsing the TAP files. See the TAP::Parser documentation for details about these callbacks. made_parser_callback This callback is executed every time a new TAP::Parser object is created. It will be passed the new parser object, the name of the file to be parsed, and also the full (temporary) path of that file. meta_yaml_callback This is a subroutine that will be called if we find and parse a YAML file containing meta information about the test run in the archive. The structure of the YAML file will be passed in as an argument. my $aggregator = TAP::Harness::Archive->aggregator_from_archive( { archive => 'my_tests.tar.gz', parser_callbacks => { plan => sub { warn "Nice to see you plan ahead..." }, unknown => sub { warn "Your TAP is bad!" }, }, made_parser_callback => sub { my ($parser, $file, $full_path) = @_; warn "$file is temporarily located at $full_path "; } } ); AUTHOR
Michael Peters, "<mpeters at plusthree.com>" BUGS
Please report any bugs or feature requests to "bug-tap-harness-archive at rt.cpan.org", or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=TAP-Harness-Archive <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=TAP-Harness-Archive>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. SUPPORT
You can find documentation for this module with the perldoc command. perldoc TAP::Harness::Archive You can also look for information at: o AnnoCPAN: Annotated CPAN documentation http://annocpan.org/dist/TAP-Harness-Archive <http://annocpan.org/dist/TAP-Harness-Archive> o CPAN Ratings http://cpanratings.perl.org/d/TAP-Harness-Archive <http://cpanratings.perl.org/d/TAP-Harness-Archive> o RT: CPAN's request tracker http://rt.cpan.org/NoAuth/Bugs.html?Dist=TAP-Harness-Archive <http://rt.cpan.org/NoAuth/Bugs.html?Dist=TAP-Harness-Archive> o Search CPAN http://search.cpan.org/dist/TAP-Harness-Archive <http://search.cpan.org/dist/TAP-Harness-Archive> ACKNOWLEDGEMENTS
o A big thanks to Plus Three, LP (<http://www.plusthree.com>) for sponsoring my work on this module and other open source pursuits. o Andy Armstrong COPYRIGHT &; LICENSE Copyright 2007 Michael Peters, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.4 2011-09-04 TAP::Harness::Archive(3pm)
All times are GMT -4. The time now is 10:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy