08-24-2008
When I run my script in debug mode I see that \ is not getting executed as part of command. It is being treated as escape character.
find ${DATABASE_PARAM_PATH} -mtime +${RETENTION_PERIOD} -exec rm -rf {} \;
Command execution output in debug mode :
find /pgmfgfpws/app/oracle/mfgfpwsdb/10.2.0/admin/mfgfpws_webisstg70/bdump -mtime +1 -exec ls -ltr {} ;
Backslash is missing. Without blackslash if bdump directory is empty after deleting all files which meet deletion criterion, find command deletes bdump directory as well. I don't want bdump directory to be deleted even though it is empty.
Any help is greatly appreciated.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
I create a file touch 1201093003 fichcomp
and inside a repertory (which hava a lot of files) I want to list all files created before this file :
find *.* \! -maxdepth 1 - newer fichcomp but this command returned bash: /usr/bin/find: Argument list too long
but i make a filter all... (1 Reply)
Discussion started by: yacsil
1 Replies
2. Shell Programming and Scripting
Yes , I have to find a file in unix without using any find or where commands.Any pointers for the same would be very helpful as i am beginner in shell scritping and need a solution for the same.
Thanks in advance.
Regards
Jatin Jain (10 Replies)
Discussion started by: jatin.jain
10 Replies
3. UNIX for Dummies Questions & Answers
I need to find whether there is a file named vijay is there or not in folder named "opt" .I tried "ls *|grep vijay" but it showed permission problem.
so i need to use find command (6 Replies)
Discussion started by: amirthraj_12
6 Replies
4. Shell Programming and Scripting
I am using csh and getting the error "find: No match." but I cannot figure out why. What I am trying to do is set the find command to a variable and then execute the variable as a command. I ran it through a debugger and it looks like $FIND is getting set but the find command can not actually be... (2 Replies)
Discussion started by: mst3k4l
2 Replies
5. Linux
Hi,
I'm using the following command to find the multiple requierd file types and its working fine
find . -name "*.pl" -o -name "*.pm" -o -name "*.sql" -o -name "*.so" -o -name "*.sh" -o -name "*.java" -o -name "*.class" -o -name "*.jar" -o -name "*.gz" -o -name "*.Z" -type f
Though... (2 Replies)
Discussion started by: vickramshetty
2 Replies
6. Shell Programming and Scripting
I want to find a dir called STOP from the root.so what is the find command.
Thanks & Regards
Rajkumar (1 Reply)
Discussion started by: rajkumar_g
1 Replies
7. Shell Programming and Scripting
Hello everyone,
first post here, trying to learn scripting on my own and this forum as been really helpful so far. I made few little scripts working great but I m facing some problems with RE.
I have a bunch of files in many subdirectories called *001.ext *002.ext OR simple *.ext or *01.ext... (7 Replies)
Discussion started by: Sekullos
7 Replies
8. Shell Programming and Scripting
Hi all ,
I'm new to unix
I have a checked project , there exists a file called xxx.config .
now my task is to find all the files in the checked out project which references to this xxx.config file.
how do i use grep or find command . (2 Replies)
Discussion started by: Gangam
2 Replies
9. Shell Programming and Scripting
Hi,
I want find multiple string in one file using find coomand.
And keeping it in one variable.grep is not working. (5 Replies)
Discussion started by: vivek1489
5 Replies
10. Solaris
Hello,
I am running some performance based tests on Solaris, and I was wondering how fast the "seeking" rate of Solaris is, or how fast Solaris can get information about files with the "find" command. Does anyone know what 'find' command I could run to traverse through my system to see the rate... (1 Reply)
Discussion started by: bstring
1 Replies
LEARN ABOUT DEBIAN
tmpwatch
TMPWATCH(8) System Administrator's Manual TMPWATCH(8)
NAME
tmpwatch - removes files which haven't been accessed for a period of time
SYNOPSIS
tmpwatch [-u|-m|-c] [-MUadfqstvx] [--verbose] [--force] [--all]
[--nodirs] [--nosymlinks] [--test] [--fuser] [--quiet]
[--atime|--mtime|--ctime] [--dirmtime] [--exclude path]
[--exclude-user user] time dirs
DESCRIPTION
tmpwatch recursively removes files which haven't been accessed for a given time. Normally, it's used to clean up directories which are
used for temporary holding space such as /tmp.
When changing directories, tmpwatch is very sensitive to possible race conditions and will exit with an error if one is detected. It does
not follow symbolic links in the directories it's cleaning (even if a symbolic link is given as its argument), will not switch filesystems,
skips lost+found directories owned by the root user, and only removes empty directories, regular files, and symbolic links.
By default, tmpwatch dates files by their atime (access time), not their mtime (modification time). If files aren't being removed when ls
-l implies they should be, use ls -u to examine their atime to see if that explains the problem.
If the --atime, --ctime or --mtime options are used in combination, the decision about deleting a file will be based on the maximum of
these times. The --dirmtime option implies ignoring atime of directories, even if the --atime option is used.
The time parameter defines the threshold for removing files. If the file has not been accessed for time, the file is removed. The time
argument is a number with an optional single-character suffix specifying the units: h for hours, d for days. If no suffix is specified,
time is in hours.
Following this, one or more directories may be given for tmpwatch to clean up.
OPTIONS
-u, --atime
Make the decision about deleting a file based on the file's atime (access time). This is the default.
Note that the periodic updatedb file system scans keep the atime of directories recent.
-m, --mtime
Make the decision about deleting a file based on the file's mtime (modification time) instead of the atime.
-c, --ctime
Make the decision about deleting a file based on the file's ctime (inode change time) instead of the atime; for directories, make
the decision based on the mtime.
-M, --dirmtime
Make the decision about deleting a directory based on the directory's mtime (modification time) instead of the atime; completely
ignore atime for directories.
-a, --all
Remove all file types, not just regular files, symbolic links and directories.
-d, --nodirs
Do not attempt to remove directories, even if they are empty.
-f, --force
Remove files even if root doesn't have write access (akin to rm -f).
-l, --nosymlinks
Do not attempt to remove symbolic links.
-q, --quiet
Report only fatal errors.
-s, --fuser
Attempt to use the "fuser" command to see if a file is already open before removing it. Not enabled by default. Does help in some
circumstances, but not all. Dependent on fuser being installed in /sbin. Not supported on HP-UX or Solaris.
-t, --test
Don't remove files, but go through the motions of removing them. This implies -v.
-U, --exclude-user=user
Don't remove files owned by user, which can be an user name or numeric user ID.
-v, --verbose
Print a verbose display. Two levels of verboseness are available -- use this option twice to get the most verbose output.
-x, --exclude=path
Skip path; if path is a directory, all files contained in it are skipped too. If path does not exist, it must be an absolute path
that contains no symbolic links.
SEE ALSO
cron(1), ls(1), rm(1), fuser(1)
WARNINGS
GNU-style long options are not supported on HP-UX.
AUTHORS
Erik Troan <ewt@redhat.com>
Preston Brown <pbrown@redhat.com>
Nalin Dahyabhai <nalin@redhat.com>
Miloslav Trmac <mitr@redhat.com>
4th Berkeley Distribution Fri Dec 14 2007 TMPWATCH(8)