find . -name '*.req' -mtime +2 -exec rm {} \; not deleting files

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat find . -name '*.req' -mtime +2 -exec rm {} \; not deleting files
# 1  
Old 11-04-2012
find . -name '*.req' -mtime +2 -exec rm {} \; not deleting files

i want to remove *.req files from directory
/opt/FFCL8001/oracle/inst/apps/FFCL8001_lhrho/logs/appl/conc/log

i executed command find . -name '*.req' -mtime +2 -exec rm {} \;

but it is running since hours and free space in /opt is same as old 7.4 GB .

why it is not removing files ?
# 2  
Old 11-04-2012
First run below command and see if the files are getting listed:-

Code:
find /opt/FFCL8001/oracle/inst/apps/FFCL8001_lhrho/logs/appl/conc/log -name "*.req" -mtime +2 -exec ls -l {} \;

If yes, then retry:-

Code:
find /opt/FFCL8001/oracle/inst/apps/FFCL8001_lhrho/logs/appl/conc/log -name "*.req" -mtime +2 -exec rm -f {} \;


Note: It is also possible that the directory which you mentioned above is not on the same file system as /opt/ . It can be a symbolic link pointing to a different file system. Please recheck.

Last edited by Yoda; 11-04-2012 at 02:24 AM..
# 3  
Old 11-04-2012
find /opt/FFCL8001/oracle/inst/apps/FFCL8001_lhrho/logs/appl/conc/log -name "*.req" -mtime +2 -exec ls -l {} \;


above command is running from many minutes it did not show any output

now after a long time it is showing output.



recently more than one hour i am getting these kind of messages displayed on screen :

find: /opt/FFCL8001/oracle/inst/apps/FFCL8001_lhrho/logs/appl/conc/log/l70747651.req: No such file or directory

Last edited by rehantayyab82; 11-04-2012 at 05:46 AM..
# 4  
Old 11-04-2012
You can automate task so Oracle database automatically delete log files

Removing Log Files
# 5  
Old 11-04-2012
with cron jobs we ccan automate removal of these files ?


but currently im in a tension because these files are not removed.
# 6  
Old 11-05-2012
Hey rehantayyab82,

If the find takes a long time just to show files, my guess is that you directory is big.

There may be a race condition as well. Some file looks like they disappear between the time they're detected by find and deleted by rm (so the warning).

How big is a req file on average. Maybe you cannot expect your operation to free much space.

Good luck
Santiago
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[Solved] Issue with deleting files through find

Hi, I have a script similar to this #!/bin/ksh cd /orcl/bir/eod_badfiles find ./ -type f -name "*.csv" -mtime +6 -exec rm -f {} \; find ./ -type f -name "*.bad" -mtime +6 -exec rm -f {} \; cd /orcl/bir find ./ -type f -name "*.log" -mtime +6 -exec rm -f {} \; This was working fine in one... (5 Replies)
Discussion started by: Gangadhar Reddy
5 Replies

2. Red Hat

Deleting using "find -mtime" not working

This command used to work in my old Linux servers to delete old files (older than 2 days, in this case) but it suddenly not working at all-- find /path/to/dir/* -mtime 2 -exec rm {} \; Anything I am missing? Would appreciate any tips. Thanks! (6 Replies)
Discussion started by: pkiula
6 Replies

3. Shell Programming and Scripting

Find by name and mtime

Hi, I'm trying to find all files that have a .ksh and .p extension and that are 7 days old by using the below find command but it doesn't seem to as expected. It gives me random results.. Can someone point out what may be wrong? find . -name "*.ksh" -o -name "*.p" -mtime -7 (2 Replies)
Discussion started by: Jazmania
2 Replies

4. UNIX for Dummies Questions & Answers

Find using mtime

Hi, so I was using mtime and its not behaving the way I would think its supposed too. I have two pdf files. One modified today and another 6 months ago. I upload them to the solaris server. Then I run the below find statements. This finds my 2 files find *.pdf -type f -name '*.pdf' this finds... (2 Replies)
Discussion started by: vsekvsek
2 Replies

5. Shell Programming and Scripting

Help on find -mtime -exec

Hello people. Part of my script: echo "Compressing files older than 2 months in ${TEMP_DIR} directory ..." find ${DATA_DIR}/ -name '*.dat' -mtime 61 -exec compress {} \; #BELOW COMMAND DOES NOT WORK :-( <<<<<<----------- find ${DATA_DIR}/ -name '*.o.lines.*' -mtime 61 -exec compress {}... (2 Replies)
Discussion started by: drbiloukos
2 Replies

6. UNIX for Dummies Questions & Answers

Req 1-liner for Awk, et al to find str position

Hi, I'm trying to find the position of a series of numbers within a large text file. The numbers are separated by spaces. This works fine: type Huge_File.txt | gawk "{print index($0,"255")}" But this does not: type Huge_File.txt | gawk "{print index($0,"188 028 239 160 016 190 137... (4 Replies)
Discussion started by: Lemming42
4 Replies

7. UNIX for Dummies Questions & Answers

(find) mtime vs. (unix) mtime

Hi I've made some test with perl script to learn more about mtime... So, my question is : Why the mtime from findfind /usr/local/sbin -ctime -1 -mtime -1 \( -name "*.log" -o -name "*.gz" \) -print are not the same as mtime from unix/linux in ls -ltr or in stat() function in perl : stat -... (2 Replies)
Discussion started by: hiddenshadow
2 Replies

8. Shell Programming and Scripting

deleting files inside shell script - ( using find)

Hi, I am using the command find /apps/qualdb/gpcn/scripts/cab_outbound/archive -name 'z*' -mtime +28 -exec rm {} \; in unix command prompt for deleting the files in my unix system under the specfied folder. It was succesfull. But when i running this command inside a shell script name... (2 Replies)
Discussion started by: Jayaram.Nambura
2 Replies

9. Shell Programming and Scripting

Deleting files using find command

I want to find the files and delete all the files except the last file. I am using find command , I am sending the find output to a file and getting all the lines except the last one and sending it to the remove command . This is not working. can anyone help me out to do it in the find command... (8 Replies)
Discussion started by: deepaklanka
8 Replies

10. Shell Programming and Scripting

(Req)Shell script req

HI All Im new to shell scripting...kindly plz help me... I need a shell script for: We have to take export of all db's on daily basis from all svr's and keep these export backups on diffrent server. Plz help. Regards Gaurav (5 Replies)
Discussion started by: ergauravtaneja
5 Replies
Login or Register to Ask a Question