strange problem in finf with mtime


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers strange problem in finf with mtime
# 1  
Old 12-24-2007
strange problem in finf with mtime

Hi All,

When i do ll , i saw the below list

ll
total 144512
drwxr-xr-x 2 weftp usr 8192 May 1 2007 weftp
drwxrwxrwx 3 wetp usr 24576 Dec 23 20:45 weftp
drwxrwxrwx 2 erer1 usr 8192 Nov 6 09:28 itm
-rwxrwxrwx 1 stj usr 1006258 Sep 19 15:33 W7041012_cpy
-rwxrwxrwx 1 stj usr 72928579 May 1 2007 greta.gz

but when i tried the below command

find /wrk/cn/trans/ -name "*" -mtime +20 -exec rm -f -r 2> /dev/null "{}" ";"

the file is not getting deleted . Can you please tell me why ?.. Whether .gz cannot be deleted. Even if .gz have restriction why W7041012_cpy is not getting deleted ..



but when i do a find only i see that


/wrk/cn/trans/W7041012_cpy
/wrk/cn/trans/greta.gz
/wrk/cn/trans/crcv/.ssh
find: cannot open /wrk/cn/trans/crcv/.ssh
/wrk/cn/trans/weftp/
...

if a find fails like the above will the rm will not perform ?? .. I am using HP UNIX

Thanks,
Arun.
# 2  
Old 12-24-2007
sorry to post again ....

I am having the one more question .

I am using find with mtime and deleting a file . I am running the find with delete in a directory . This directory containd one more directory in it . My scheduled find with delete finds the filesin the sub directory and deletes the file . But it id not doing the the same in the present directory . It is not deleting rather it is listing the files in the current directory .

-rwxrwxrwx 1 scot cusr 1006258 Sep 19 15:33 s7041012
-rwxrwxrwx 1 scot cusr 72928579 May 1 2007 sp.gz

i cannot delete these file by find with delete . But the below files were deleted . But these files are in the subdirectory.

-rw-r--r-- 1 p13 datps 3462975 Dec 13 12:14 t52
-rw-r--r-- 1 p13 datps 3506325 Dec 20 13:34 t01
-rw-r----- 1 cftp cusr 49981106 Dec 12 09:41 p112

Can any one please let me know the reason ..

If that is permission problem . like that the file created by scot cannot be deleted . the even though rwxrwxrwx is set for s7041012 why it is not deleting . How can it be done ?..

Thanks,
Arun
# 3  
Old 12-24-2007
Do not use:
2 > /dev/null
in a command and then complain that you don't know why it failed. The "2 > /dev/null" is asking the command to hide error messages. Smilie Try it again without the "2 > /dev/null" and see if you get any messages.
# 4  
Old 12-24-2007
Please see the error i saw when i doing a find

find /wrk/cn/tranr/ -name "*" -mtime +100 -exec rm -f -r

find /work/cn/tranr/ -name "*" -mtime +100 -exec rm -f -r {} ;



Thanks,
Arun
# 5  
Old 12-24-2007
sorry i didnt posted the error ..

find /wrk/cn/trans/ -name "*" -mtime +100 -exec rm -f -r
find: -exec not terminated with ';'

find /wrk/cn/trans/ -name "*" -mtime +100 -exec rm -f -r {};
find: -exec not terminated with ';'


How can i overcome the same

Thanks,
Arun
# 6  
Old 12-24-2007
Return to the syntax you used in the first post:

"{}" ";"
# 7  
Old 12-24-2007
Thanks perdebro..

It worked ..

(sys22Smilienlfct:/work/can/transfer>) find /work/can/transfer/ -name "*" -mtime +100 -exec rm -f -r "{}" ";"
rm: /work/can/transfer/spcurruswst.gz not removed. Permission denied


but the file is having full permision .. I have raised a seperate thread for this permision issue.

-rwxrwxrwx 1 scottj canusr 1006258 Sep 19 15:33 s7041012_copy

Thanks again,
Arun.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Strange Problem

Hi All, I am encountering an unexpected problem while running my process, using daemon placed in /etc/init.d/. I have a process that is opening shared library using dlopen. When I run my process on the command line, it is able to open the library. But when I used daemon to run my process, I... (0 Replies)
Discussion started by: qwerty-1
0 Replies

2. 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

3. AIX

-mtime Problem

Hi, I'm using command "find . -mtime +10 -type f -print" to list the files 10 days or older but I'm getting the files which are even created today. What am I doing wrong? Thanks. (1 Reply)
Discussion started by: Gbyte
1 Replies

4. Shell Programming and Scripting

Strange problem.

Well, my script started off to do what i wanted. Now, i think its not recognizing the pattern so its not moving anything. What i have to do is execute my script command for the move to take effect. So i did that and yayy it worked. Strange thing is that my DESTDIR was empty to begin with.... (2 Replies)
Discussion started by: oxoxo
2 Replies

5. UNIX for Dummies Questions & Answers

Problem with find command when used with mtime

All, Please find the below comand . I am trying to list the file that has not been accesed is past 14 days . But when you look at the display the directory "crecv1" which has date as today is displayed .. Why it is happening . I send this code instead of ls -ltr as rm -f -r in production... (4 Replies)
Discussion started by: arunkumar_mca
4 Replies

6. Shell Programming and Scripting

problem in mtime

Hey champs, i am using the following commands to search 1day files available under a dir by shell script. find <dirname> -type f -mtime +1 sometimes it used to show me correct results.....but sometimes it's not ??? if the above one not working perfect i.e. not showing me the exact... (2 Replies)
Discussion started by: manas_ranjan
2 Replies

7. UNIX for Dummies Questions & Answers

problem with find and mtime

I am using HP-UNIX , The below command doesnt display anything although i have changed a file in the directory by toutch -t 200010101800 nfile find /tmp/transfer/ -name "*.*" -mtime +1 Any problrm with the find command i written . .Please help ??.. Thanks, Arun (4 Replies)
Discussion started by: arunkumar_mca
4 Replies

8. Shell Programming and Scripting

Strange problem

I am using SunOS 5.9 and I don't know why all my commands are getting executed as if an extra 'enter' has been pressed. What could be the reason and how to correct it? Please help. Asty (2 Replies)
Discussion started by: Asty
2 Replies

9. Linux

very strange problem

I have installed Fedora Core on a Toshiba Satellite Pro4600 laptop recently I have experienced a rather mysterious problem if I touch anything specially the keyboard or mouse I see this stuff “67yujhnmyyy” straight away some time it won't stop for while like this... (5 Replies)
Discussion started by: kemobyte
5 Replies

10. UNIX for Dummies Questions & Answers

Strange problem.Please Help !

I¡¯m a network operator, mine is an IBM PC server 320, operating system SCO unix 3.2v4.2, triton 3.1 of Baan. Recently, my server went dead every a few hours, no sign & signal shows malfunction suddenly. It looks like a sudden power failure, but the indicator of main power supply is on. Normal... (1 Reply)
Discussion started by: lyhsm
1 Replies
Login or Register to Ask a Question