07-10-2007
I got solution for this one i need to change my command like this
find -type d -mtime +3 -exec rm -r {} \;
Or
find -mtime +3 -exec rm -r {} \;
Thanks
10 More Discussions You Might Find Interesting
1. Solaris
Hi Gurus
I am facing a problem, there is a folder called /a where there are lots of files which are occupying space anything between 30 GB to 100 GB as I am not able to check the space occupied by that folder through "du -sh /a" command as I don't see any output after more than 1 hour of... (4 Replies)
Discussion started by: amity
4 Replies
2. Shell Programming and Scripting
Hi All,
The following find command lists the files which are 45 minutes older. But it searches for the sub directories also.
$ find . -type f -mmin +45 -print
./hello.txt
./test/hi.txt
./temp/now.txt
ls
hello.txt test temp
How can i modify the find command in such way that it finds... (4 Replies)
Discussion started by: Tuxidow
4 Replies
3. UNIX for Dummies Questions & Answers
I did this:
ls -lrRt | grep ^* | cksum *
but it is showing cksum of sub-directories.
Thanks You
Please use code tags when posting data and code samples, thank you. (3 Replies)
Discussion started by: ezee
3 Replies
4. Shell Programming and Scripting
My code to "Delete empty files from a directory entered in command promt"
#/bin/sh
echo "Enter directory"
read gh
for file in `ls $gh`
do
# to get the size of file
a=$( ls -l file | awk ' {print $7} ');
echo $a
if
then
echo "removing file "
rm file
fi
done (6 Replies)
Discussion started by: adirajup
6 Replies
5. Shell Programming and Scripting
Hello All,
Can someone please help me out in creating the find command to search and delete files older than 1 days at a desired location.
Thanks in advance for your help. (3 Replies)
Discussion started by: Pandee
3 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I want to delete all the log files that was created on year 2008. My command is not working. Any idea?
find . -name '*.log' -mtime 1460 -exec ls -lt {} \;
Thank you. (2 Replies)
Discussion started by: samnyc
2 Replies
7. Shell Programming and Scripting
Hi All,
I've created 2 files
touch -t 201309101234 aa10
touch -t 201309111234 aa11
Exact 60 days before from today date is SEPT 12th . As per the following command as i gave +60 means the files which were created before sept12th should be deleted
find /etc/logs/*aa* -type f -atime +60... (5 Replies)
Discussion started by: smile689
5 Replies
8. Shell Programming and Scripting
Hello Friends,
I have directory called /tmp. which stores the log files.
Whenever it becomes full, i want to delete half of files from all log files.
even after deleting the files, if space is more than 90% then it should delete rest of half files.
While deleting files, older files... (7 Replies)
Discussion started by: Nakul_sh
7 Replies
9. Shell Programming and Scripting
hi,
i have a requirement to delete all the files from all the directories except some specific directories like archive and log.
for example:
there are following directories such as
A B C D Archive E Log F
which contains some sub directories and files. The requirement is to delete all the... (7 Replies)
Discussion started by: Little
7 Replies
10. UNIX for Dummies Questions & Answers
Hi,
I have a main folder 'home'. Lets say there is a folder 'bin' under 'home'. I want to check the list of files under subdirectories present under the /bin directory created in the last 24 hours.
I am using the following find command under home/bin directory:
find . -mtime -1 -print
... (3 Replies)
Discussion started by: DJose
3 Replies
FIND(1) General Commands Manual FIND(1)
NAME
find - find files
SYNOPSIS
find pathname-list expression
DESCRIPTION
Find recursively descends the directory hierarchy for each pathname in the pathname-list (i.e., one or more pathnames) seeking files that
match a boolean expression written in the primaries given below. In the descriptions, the argument n is used as a decimal integer where +n
means more than n, -n means less than n and n means exactly n.
-name filename
True if the filename argument matches the current file name. Normal Shell argument syntax may be used if escaped (watch out for
`[', `?' and `*').
-perm onum
True if the file permission flags exactly match the octal number onum (see chmod(1)). If onum is prefixed by a minus sign, more
flag bits (017777, see stat(2)) become significant and the flags are compared: (flags&onum)==onum.
-type c True if the type of the file is c, where c is b, c, d or f for block special file, character special file, directory or plain
file.
-links n True if the file has n links.
-user uname
True if the file belongs to the user uname (login name or numeric user ID).
-group gname
True if the file belongs to group gname (group name or numeric group ID).
-size n True if the file is n blocks long (512 bytes per block).
-inum n True if the file has inode number n.
-atime n True if the file has been accessed in n days.
-mtime n True if the file has been modified in n days.
-exec command
True if the executed command returns a zero value as exit status. The end of the command must be punctuated by an escaped semi-
colon. A command argument `{}' is replaced by the current pathname.
-ok command
Like -exec except that the generated command is written on the standard output, then the standard input is read and the command
executed only upon response y.
-print Always true; causes the current pathname to be printed.
-newer file
True if the current file has been modified more recently than the argument file.
The primaries may be combined using the following operators (in order of decreasing precedence):
1) A parenthesized group of primaries and operators (parentheses are special to the Shell and must be escaped).
2) The negation of a primary (`!' is the unary not operator).
3) Concatenation of primaries (the and operation is implied by the juxtaposition of two primaries).
4) Alternation of primaries (`-o' is the or operator).
EXAMPLE
To remove all files named `a.out' or `*.o' that have not been accessed for a week:
find / ( -name a.out -o -name '*.o' ) -atime +7 -exec rm {} ;
FILES
/etc/passwd
/etc/group
SEE ALSO
sh(1), test(1), filsys(5)
BUGS
The syntax is painful.
FIND(1)