Sponsored Content
Top Forums Shell Programming and Scripting find command not searching path when -newer specified Post 302657761 by fletchdb2 on Monday 18th of June 2012 10:36:44 AM
Old 06-18-2012
find command not searching path when -newer specified

When this command is issued from a directory other than where the file is located it works fine:
Code:
find /db2/D01/log_archive/ -name "S0002166.LOG" -type f
/db2/D01/log_archive/db2d01/D01/NODE0000/C0000000/S0002166.LOG

When I change -name to -newer, it doesn't work. Find only searches the current directory, not the path specified:

Code:
find /db2/D01/log_archive/ -newer "S0002166.LOG" -type f
find: S0002166.LOG: No such file or directory

There are files in the path newer than the one specified. The correct results are returned only if I execute the command in the same directory as the file, so it appears that with -newer, the find path isn't being searched.
What am I doing wrong?

Moderator's Comments:
Mod Comment Please use next time code tags for your code and data

Last edited by vbe; 06-18-2012 at 11:42 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Find files newer than...

Is there a way to use the find command to locate files newer than a specific date? Thanks! --Alex (4 Replies)
Discussion started by: vertigo23
4 Replies

2. Shell Programming and Scripting

Problem with find ! -newer

Hi, I would like to find if a file called test.log is older than 10 min. So i wrote : #!/usr/bin/ksh FICLOG="/home/uuu/result_test.log" FIC="/home/uuu/test.log" touch -t `perl -e 'use POSIX qw(strftime); printf("%s\n",strftime("%m%d%H%M",localtime(time-3600*0.17)));'`... (3 Replies)
Discussion started by: dbfree
3 Replies

3. UNIX for Dummies Questions & Answers

command to find the path of a file

What is the command to find the path of a file if we know the file name and the root directory where the file resides.. For eg. if a file abc.dat resides in /home/mydir/myfiles/. I am looking for a command which will be fired from / directory, takes abc.dat as input and display the path of... (3 Replies)
Discussion started by: abhilashnair
3 Replies

4. UNIX for Dummies Questions & Answers

create PATH from find command output

I'm trying to autogenerate a PATH variable from the output of a find command as follows: PATH=`find $dir -name "*.jar" | sed 's/$/:/'` The output looks similar like this if I echo it: PATH=/path/to/1.jar: /path/to/2.jar: /path/to/3.jar: I want the path to be on one line. I'm on... (3 Replies)
Discussion started by: rein
3 Replies

5. UNIX for Advanced & Expert Users

find -cmin or fin -newer

I am running SUSE/8 and SUSE/9 on a high end server (4 CPU, 8G RAM etc) I have a huge directory structure with over 4million files in it. I have find the files that are modified (created, modified, renamed etc etc) in the last 10 minutes periodically. I have tried "find -cmin -10" and "find... (2 Replies)
Discussion started by: xxxyyyy
2 Replies

6. Shell Programming and Scripting

Problems with find's -newer Flag

I am writing a script that looks in a reports directory, copies a specified script to a working folder, copies some data files into the working folder, runs the report, zips the new files, then uploads them. Right now to determine what files to zip (as I don't know how many report files there... (6 Replies)
Discussion started by: droppedonjapan
6 Replies

7. UNIX for Dummies Questions & Answers

command to find the absolute path

i understand by using the pwd command we get the present working directory. which command is used to find absolute path from home directory to root.. What is absolute path to your and root user's home directory.:confused::confused::confused: (2 Replies)
Discussion started by: shaziafathima
2 Replies

8. UNIX for Dummies Questions & Answers

Find files newer than x days

We had an arrant rsync run and started copying over new files from one system to another. Although this is what we will want to do at some point, for now, we want to maintain the system as it was a few days ago. I am looking for a script that will find files that are newer than x days. ... (5 Replies)
Discussion started by: Leyva62
5 Replies

9. UNIX for Dummies Questions & Answers

Find command not searching recursively

I'm searching for particular scripts that contain pattern "BASIS" so I used the following command: find . -type f -print | xargs grep "BASIS" or find . -type f -exec grep "BASIS" {} \; However, I found out that the find command in the UNIX box that I'm working on doesn't find files... (6 Replies)
Discussion started by: The Gamemaster
6 Replies

10. Red Hat

How to find the path of a command?

Hi guys. I want to know the path of a command. I tried "which" command also . But no luck. Please tell me how to find and update the correct path of the command. Here I'm unable to find the path of ext2online command # resize2fs /dev/vg01/lvora_backup resize2fs 1.39 (29-May-2006)... (3 Replies)
Discussion started by: vamshigvk475
3 Replies
db_archive(1)						    BSD General Commands Manual 					     db_archive(1)

NAME
db_archive SYNOPSIS
db_archive [-adlsVv] [-h home] [-P password] DESCRIPTION
The db_archive utility writes the pathnames of log files that are no longer in use (for example, no longer involved in active transactions), to the standard output, one pathname per line. These log files should be written to backup media to provide for recovery in the case of cata- strophic failure (which also requires a snapshot of the database files), but they may then be deleted from the system to reclaim disk space. The options are as follows: -a Write all pathnames as absolute pathnames, instead of relative to the database home directories. -d Remove log files that are no longer needed; no filenames are written. Automatic log file removal is likely to make catastrophic recovery impossible. -h Specify a home directory for the database environment; by default, the current working directory is used. -l Write out the pathnames of all the database log files, whether or not they are involved in active transactions. -P Specify an environment password. Although Berkeley DB utilities overwrite password strings as soon as possible, be aware there may be a window of vulnerability on systems where unprivileged users can see command-line arguments or where utilities are not able to overwrite the memory containing the command-line arguments. -s Write the pathnames of all the database files that need to be archived in order to recover the database from catastrophic failure. If any of the database files have not been accessed during the lifetime of the current log files, db_archive will not include them in this out- put. It is possible that some of the files to which the log refers have since been deleted from the system. In this case, db_archive will ignore them. When db_recover is run, any files to which the log refers that are not present during recovery are assumed to have been deleted and will not be recovered. -V Write the library version number to the standard output, and exit. -v Run in verbose mode, listing the checkpoints in the log files as they are reviewed. Log cursor handles (returned by the DB_ENV->log_cursor method) may have open file descriptors for log files in the database environment. Also, the Berkeley DB interfaces to the database environment logging subsystem (for example, DB_ENV->log_put and DB_TXN->abort) may allocate log cursors and have open file descriptors for log files as well. On operating systems where filesystem related system calls (for example, rename and unlink on Windows/NT) can fail if a process has an open file descriptor for the affected file, attempting to move or remove the log files listed by db_archive may fail. All Berkeley DB internal use of log cursors operates on active log files only and furthermore, is short-lived in nature. So, an application seeing such a failure should be restructured to close any open log cursors it may have, and other- wise to retry the operation until it succeeds. (Although the latter is not likely to be necessary; it is hard to imagine a reason to move or rename a log file in which transactions are being logged or aborted.) The db_archive utility uses a Berkeley DB environment (as described for the -h option, the environment variable DB_HOME, or because the util- ity was run in a directory containing a Berkeley DB environment). In order to avoid environment corruption when using a Berkeley DB environ- ment, db_archive should always be given the chance to detach from the environment and exit gracefully. To cause db_archive to release all environment resources and exit cleanly, send it an interrupt signal (SIGINT). The DB_ENV->log_archive method is the underlying method used by the db_archive utility. See the db_archive utility source code for an example of using DB_ENV->log_archive in a IEEE/ANSI Std 1003.1 (POSIX) environment. The db_archive utility exits 0 on success, and >0 if an error occurs. ENVIRONMENT
DB_HOME If the -h option is not specified and the environment variable DB_HOME is set, it is used as the path of the database home, as described in DB_ENV->open. SEE ALSO
db_checkpoint(1), db_deadlock(1), db_dump(1), db_load(1), db_printlog(1), db_recover(1), db_stat(1), db_upgrade(1), db_verify(1) Darwin December 3, 2003 Darwin
All times are GMT -4. The time now is 06:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy