Sponsored Content
Top Forums UNIX for Dummies Questions & Answers what is a "find stat() error" Post 302314076 by jim mcnamara on Thursday 7th of May 2009 10:29:01 AM
Old 05-07-2009
find works by calling either ftw() or nftw() - these functions traverse a file tree, and return the results from a stat() call for every file found.

stat is a system call that returns metadata about a file - size, last modification date, permissions, etc. I/O errors occur when the filesystem metadata has a problem or the disk(s) has bad sectors, etc.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

grep to find content in between curly braces, "{" and "},"

problem String ~~~~~~~~~~~~~~~~~~ icecream= { smart peopleLink "good" LC "happy" , smartpeopleLink "dull" LC "sad" } aend = {smart vc4 eatr kalu} output needed ~~~~~~~~~~~~~~~~~~ smart peopleLink "good" LC "happy" , smartpeopleLink "dull" LC "sad" smart vc4... (4 Replies)
Discussion started by: keshav_rk
4 Replies

2. Shell Programming and Scripting

"find command" to find the files in the current directories but not in the "subdir"

Dear friends, please tell me how to find the files which are existing in the current directory, but it sholud not search in the sub directories.. it is like this, current directory contains file1, file2, file3, dir1, dir2 and dir1 conatins file4, file5 and dir2 contains file6,... (9 Replies)
Discussion started by: swamymns
9 Replies

3. Solaris

How to resolve error "INIT: Cannot stat /etc/inittab, errno: 2"

Hi All, I am getting an error message when I execute command “zlogin -C sunsrv4z5” on my root server. INIT: Cannot stat /etc/inittab, errno: 2 INIT: Cannot stat /etc/inittab, errno: 2 As per my analysis it seems that some files inside /etc folder are deleted. This server was... (14 Replies)
Discussion started by: surbhit4u
14 Replies

4. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

5. Shell Programming and Scripting

Ignoring mv commands "cannot stat" error ?

So, my third thread here ^^ and still asking questions. Thanks for you patience and help, I really appreciated it ;) I currently use a shell script to move folders of songs from one to another location on my harddrive. I use something like this: sudo mv /var/mobile/Media/"My Music"/"Vasco... (3 Replies)
Discussion started by: pasc
3 Replies

6. Shell Programming and Scripting

Intermittent "cp: cannot stat" error with nested loop

I have a bash script that has been running (on SUSE 9.3) dozens of times over the past couple of years without error. Recently it has been hitting intermittent “cp: cannot stat FILE: No such file or directory” errors. The script has nested loops that continuously process files in a... (2 Replies)
Discussion started by: jcart
2 Replies

7. AIX

Equalent of Linux "stat" in AIX

i would like to know the equivalent of stat -c %Y <file> command in AIX. i tried "istat" but its not giving the epoch time and also tried with perl perl -le'printf "%o", 07777 & (stat) for @ARGV' <file> it not also provding the timing . ... (3 Replies)
Discussion started by: expert
3 Replies

8. Shell Programming and Scripting

Find lines with "A" then change "E" to "X" same line

I have a bunch of random character lines like ABCEDFG. I want to find all lines with "A" and then change any "E" to "X" in the same line. ALL lines with "A" will have an "X" somewhere in it. I have tried sed awk and vi editor. I get close, not quite there. I know someone has already solved this... (10 Replies)
Discussion started by: nightwatchrenba
10 Replies

9. UNIX for Dummies Questions & Answers

Is "stat: illegal option -- -" an issue with hyphenated filename or flag problem?

Hi. I'm trying to install VMWare Workstation to run a virtual machine on my Mac OS, but running the bundle from bash(xterm) sh VMware-workstation-Full-11.0.0-2305329.x86_64.bundle (as suggested in install guide) comes up with error:stat: illegal option -- - usage: stat Digging... (5 Replies)
Discussion started by: defeated
5 Replies

10. Shell Programming and Scripting

find . -path "*_nobackup*" -prune -iname "*.PDF" \( ! -name "*_nobackup.*" \)

These three finds worked as expected: $ find . -iname "*.PDF" $ find . -iname "*.PDF" \( ! -name "*_nobackup.*" \) $ find . -path "*_nobackup*" -prune -iname "*.PDF" They all returned the match: ./folder/file.pdf :b: This find returned no matches: $ find . -path "*_nobackup*" -prune... (3 Replies)
Discussion started by: wolfv
3 Replies
FTW(3)							     Linux Programmer's Manual							    FTW(3)

NAME
ftw, nftw - file tree walk SYNOPSIS
#include <ftw.h> int ftw(const char *dir, int (*fn)(const char *file, const struct stat *sb, int flag), int depth); int nftw(const char *dir, int (*fn)(const char *file, const struct stat *sb, int flag, struct FTW *s), int depth, int flags); DESCRIPTION
ftw() walks through the directory tree starting from the indicated directory dir. For each found entry in the tree, it calls fn() with the full pathname of the entry, a pointer to the stat(2) structure for the entry and an int flag, which value will be one of the following: FTW_F Item is a normal file FTW_D Item is a directory FTW_DNR Item is a directory which can't be read FTW_SL Item is a symbolic link FTW_NS The stat failed on the item which is not a symbolic link If the item is a symbolic link and stat failed, XPG4v2 states that it is undefined whether FTW_NS or FTW_SL is used. ftw() recursively calls itself for traversing found directories, handling a directory before its files or subdirectories. To avoid using up all a program's file descriptors, the depth specifies the number of simultaneous open directories. When the depth is exceeded, ftw() will become slower because directories have to be closed and reopened. ftw() uses at most one file descriptor for each level in the file hierarchy. To stop the tree walk, fn() returns a non-zero value; this value will become the return value of ftw(). Otherwise, ftw() will continue until it has traversed the entire tree, in which case it will return zero, or until it hits an error other than EACCES (such as a malloc(3) failure), in which case it will return -1. Because ftw() uses dynamic data structures, the only safe way to exit out of a tree walk is to return a non-zero value. To handle inter- rupts, for example, mark that the interrupt occurred and return a non-zero value--don't use longjmp(3) unless the program is going to ter- minate. The function nftw() does precisely the same as ftw(), except that it has one additional argument flags (and calls the supplied function with one more argument). This flags argument is an OR of zero or more of the following flags: FTW_CHDIR If set, do a chdir() to each directory before handling its contents. FTW_DEPTH If set, do a depth-first search, that is, call the function for the directory itself only after handling the contents of the direc- tory and its subdirectories. FTW_MOUNT If set, stay within the same file system. FTW_PHYS If set, do not follow symbolic links. (This is what you want.) If not set, symbolic links are followed, but no file is reported twice. If FTW_PHYS is not set, but FTW_DEPTH is set, then the function fn() is never called for a directory that would be a descendant of itself. The function fn() is called with four arguments: the pathname of the reported entry, a pointer to a struct stat for this entry, an integer describing its type, and a pointer to a struct FTW. The type will be one of the following: FTW_F, FTW_D, FTW_DNR, FTW_SL, FTW_NS (with meaning as above; FTW_SL occurs only with FTW_PHYS set) or FTW_DP Item is a directory and all its descendants have been handled already. (This occurs only with FTW_DEPTH set.) FTW_SLN Item is a symbolic link pointing to a nonexisting file. (This occurs only with FTW_PHYS unset.) The struct FTW pointed at by the fourth argument to fn() has at least the fields base, the offset of the item's filename in the pathname given as first argument of fn(), and level, the depth of the item relative to the starting point (which has depth 0). NOTES
The function nftw() and the use of FTW_SL with ftw() were introduced in XPG4v2. On some systems ftw() will never use FTW_SL, on other systems FTW_SL occurs only for symbolic links that do not point to an existing file, and again on other systems ftw() will use FTW_SL for each symbolic link. For predictable control, use nftw(). Under Linux, libc4 and libc5 and glibc 2.0.6 will use FTW_F for all objects (files, symbolic links, fifos, etc) that can be stat'ed but are not a directory. The function nftw() is available since glibc 2.1. CONFORMING TO
AES, SVID2, SVID3, XPG2, XPG3, XPG4, XPG4v2. SEE ALSO
stat(2) Linux 1999-06-25 FTW(3)
All times are GMT -4. The time now is 11:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy