The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Find command uisng -prune or -only 2reperry UNIX for Advanced & Expert Users 7 02-22-2008 12:55 PM
find command with prune help venu_nbk UNIX for Dummies Questions & Answers 2 05-28-2007 03:25 AM
Find command with prune and exec Sebarry UNIX for Advanced & Expert Users 1 06-18-2006 10:43 AM
Use -prune with find command on AIX FuzzySlippers UNIX for Dummies Questions & Answers 5 11-08-2002 06:24 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 06-18-2006
Registered User
 

Join Date: Jun 2006
Posts: 6
Find command with prune and exec options

Hi,

I'm using the following command to get a list of files on the system.

find /releases -type f -exec ls -l > /home/sebarry/list.txt '{}' \;

however, its searching a directory I don't want it to search so I know I have to use prune but I don't seem to be able to get prune and exec to work in the same command. I need an exec of ls -l because of the files found I want a long listing - their size etc.

The command works when instead of exec-ing I print.

find /releases -type f -path /releases/.snapshot -prune -o -print

but this doesn't

find /releases -type f -path /releases/.snapshot -prune -o -exec ls -l {} \;

Any help most, most appreciated

Sean
Reply With Quote
Forum Sponsor
  #2  
Old 06-18-2006
tayyabq8's Avatar
Moderator
 

Join Date: Nov 2004
Location: Bahrain
Posts: 555
Try this:
Code:
find /releases -type f -name /releases/.snapshot -prune -o -exec ls -l {} \;
If no joy, submit the error message you receive.

Regards,
Tayyab
Reply With Quote
  #3  
Old 06-19-2006
Registered User
 

Join Date: Jun 2006
Posts: 6
Thanks for your help

Hi Tayyab,

Thanks for that it almost worked but it wasn't pruning out the directories. I tried variations of it and I could ignore the files and directories under .snapshot but the names of other directories would appear in the output even though I only want files.

I found that this worked:

find /releases -name .snapshot -prune -o -type f -exec ls -l {} \; > /releases/filesonreleases.txt

Cheers,

Sean
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 12:06 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0