Go Back   The UNIX and Linux Forums > Operating Systems > AIX
google site



AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace.

Closed Thread
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-08-2009
Registered User
 

Join Date: Dec 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
find {start} -ls - Two Passes?

I have a "find {start} -ls" command listing all files and dirs in on the whole filesystem.

As part of this it lists locations that contain temporary files and, sometimes when executing, it identifies a file but produces an ERROR when trying to list it.

ERROR thrown: find: bad status-- {filename}

This only occurs on temporary files which are not present when we manually look for them after the ERROR is seen. As such we believe that it is caused by the file vanishing between the "find {start}" part and the "-ls" part of the command.

Can someone confirm that "find -ls" uses two passes?
If this is the case, then can someone suggest a one pass alternative that gives the full path of each file/dir and long output?

Thanks in advance.
Sponsored Links
  #2  
Old 12-08-2009
wfavorite's Avatar
Registered User
 

Join Date: Nov 2009
Location: New Hampshire
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Confirmed

The "problem" with AIX utilities is that I can't "crack them open" short of using ProbeVue or truss. (You have no access to the source.) But I can say this: The information you speak of comes from two different calls. readdir() "scans" for all files in a directory, and stat() (or variant) gives the ls info.

If you do not need the ls information then the call to stat() would (should) never be made unless you are filtering on access time or something like that.

My recommendation is to capture stderr so you can avoid the ugliness you speak of. If the error message is mixed in stdout, it would be trivial to write your own version in C that does not (watch out for soft links if you do). Another option is to look at the -R option to ls, it may produce similar output but generate errors that are different (once again, provided that you are getting stuff that should be stderr in your stdout).
  #3  
Old 12-08-2009
Registered User
 

Join Date: Dec 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Top notch wfavorite. Thanks.

I will look into the effectiveness of using stderr. I'll let you know how I get on.
Sponsored Links
Closed Thread

Tags
aix, find

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
iTunes Store: How do I turn off email notifications for passes, season passes, and mu Linux Bot OS X Support RSS 0 06-23-2009 12:15 AM
KSH script: piping passes command-line arguments gemtry Shell Programming and Scripting 1 06-11-2009 07:30 AM
Check if parameter passes in contains certain string bcunney Shell Programming and Scripting 9 08-15-2008 09:54 AM
script to find latest executable in particular directory and start that particular ex kvineeth Shell Programming and Scripting 6 09-24-2007 07:19 AM
Bash passes flags to shell wrong andyj Shell Programming and Scripting 7 07-07-2003 03:01 PM



All times are GMT -4. The time now is 02:45 AM.