03-28-2005
Is there a better way of doing the same task
Thanks borg.. I applied the same solution -depth.. I could see the problem, I can only run it once. The next time the same command will not be executed as it will not have execute permission. Is there a better way of doing the same task.
bye
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
i have a script, which is continuously looping. i want to view the script name when i use ps command... it is only showing -sh ...
UID PID PPID C STIME TTY TIME COMMAND
informix 8533 20923 0 18:19:28 pts/ta 0:00 -sh
but i dont have my scriptname displayed .... how can i do that my script is... (0 Replies)
Discussion started by: guhas
0 Replies
2. Shell Programming and Scripting
Ok I admit it I am stumped and I would appreciate any and all help
Here is what I am trying to do.
Korn Shell script
I am setting a variable to another shell script that I want to invoke in my main script like so:
GETDIR=/vol100/cfg/.getdir
The .getdir shell script take a parameter,... (4 Replies)
Discussion started by: Batch
4 Replies
3. Shell Programming and Scripting
I am trying to change permission for all subdirectories and files inside folder1 so this is what i came with after many seraches on the internet. man find and man chmod mirc and few articles.
find .public_html/folder1 -print0 | xargs -0 chmod 777
what's wrong with this command?
it is FTP... (33 Replies)
Discussion started by: smoother
33 Replies
4. Windows & DOS: Issues & Discussions
Hi, Please accept my apologies if I have not explained anything clearly enough but i am a little old on new lingo!!!
I am running XP from home and last night the following happened.
After being logged on for pretty much the full day, I had what seemed like a pop up come up. Although most pop... (3 Replies)
Discussion started by: nike1601
3 Replies
5. UNIX for Advanced & Expert Users
--------------------------------------------------------------------------------
hy guys,
i got few interview questions i need someone to answer urgently:
1)If you cant get to the root, you try to fsck it, but gets errors to read file systems. What steps do you take to recover the host... (1 Reply)
Discussion started by: charneet
1 Replies
6. Shell Programming and Scripting
Hi,
Below is my issue which I desperately need and I want a shell script which can do this job.
I need this script as I m planning to put this for a system health check. Please assist me.
1. There are 10 log files in a particular location.
2. open each log file. Goto to the end of the... (1 Reply)
Discussion started by: kashriram
1 Replies
7. Shell Programming and Scripting
Hi,
I have a small grepping problem in my script.I am having a file from which i need to make sure "#^A17" is the last updation (Next # can be ignored) before ################.The idea behind this is, if this file contains "A17" as the last updation, i need to do a particular activity. please... (7 Replies)
Discussion started by: Renjesh
7 Replies
8. Shell Programming and Scripting
Hello everyone, my friend is asking for yOur Help. He is asking the script for combined find and changemode utility... Thank you (4 Replies)
Discussion started by: iennetastic
4 Replies
9. Shell Programming and Scripting
Hi,
I have a directory, where i get 4 files for each day... The files will be generated at any time. I am trying for a shell script for copying the file from this directory whenever new file is generated.
Say for example : If the directory X has following files A1,A2,A3,A4,B1,B2,B3,B4...... (2 Replies)
Discussion started by: krishh.kk
2 Replies
10. Shell Programming and Scripting
Hi
I want to create a script which deleted files in the following folders older than 30 days. There are a particular version of files inside it to be deleted
Folders :
/files0/interfaces/ResponsysSavedList/BackInStock/EmailContent/backup... (3 Replies)
Discussion started by: Scudza
3 Replies
ftw(3) Library Functions Manual ftw(3)
Name
ftw - walk a file tree
Syntax
#include <ftw.h>
int ftw (path, fn, depth)
char *path;
int (*fn) ( );
int depth;
Description
The subroutine recursively descends the directory hierarchy rooted in path. For each object in the hierarchy, calls fn, passing it a
pointer to a null-terminated character string containing the name of the object, a pointer to a stat structure containing information about
the object, and an integer. For further information, see Possible values of the integer, defined in the <ftw.h> header file, are FTW_F for
a file, FTW_D for a directory, FTW_DNR for a directory that cannot be read, and FTW_NS for an object for which stat could not successfully
be executed. If the integer is FTW_DNR, descendants of that directory will not be processed. If the integer is FTW_NS, the the contents
of the stat structure will be undefined. An example of an object that would cause FTW_NS to be passed to fn would be a file in a directory
with read but without execute (search) permission.
The subroutine visits a directory before visiting any of its descendants.
The tree traversal continues until the tree is exhausted, an invocation of fn returns a nonzero value, or some error is detected within
(such as an I/O error). If the tree is exhausted, returns zero. If fn returns a nonzero value, stops its tree traversal and returns what-
ever value was returned by fn. If detects an error, it returns -1, and sets the error type in errno.
The subroutine uses one file descriptor for each level in the tree. The depth argument limits the number of file descriptors so used. If
depth is zero or negative, the effect is the same as if it were 1. The depth must not be greater than the number of file descriptors cur-
rently available for use. The subroutine will run more quickly if depth is at least as large as the number of levels in the tree.
Restrictions
Because is recursive, it is possible for it to terminate with a memory fault when applied to very deep file structures.
It could be made to run faster and use less storage on deep structures at the cost of considerable complexity.
The subroutine uses to allocate dynamic storage during its operation. If is forcibly terminated, such as by longjmp being executed by fn
or an interrupt routine, will not have a chance to free that storage, so it will remain permanently allocated. A safe way to handle inter-
rupts is to store the fact that an interrupt has occurred, and arrange to have fn return a nonzero value at its next invocation.
Diagnostics
[EACCES] Search permission is denied on a component of path or read permission is denied for path.
[ENAMETOOLONG] The length of the path string exceeds {PATH_MAX}, or a pathname component is longer than {NAME_MAX}.
[ENOENT] The path argument points to the name of a file which does not exist, or to an empty string and the environment defined is
POSIX or SYSTEM_FIVE.
[ENOTDIR] A component of path is not a directory.
[ENOMEM] Not enough memory was available to complete the file tree walk.
See Also
stat(2), malloc(3)
ftw(3)