The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Question regarding permision and seguid bit (sticky bit) arunkumar_mca UNIX for Dummies Questions & Answers 2 01-09-2008 07:18 AM
Delete database table based on months using script. Maverick79 UNIX for Advanced & Expert Users 0 08-30-2007 03:27 AM
Need to delete the files based on the time stamp of the file samudha UNIX for Dummies Questions & Answers 2 06-20-2007 08:02 AM
File Permision sommyp UNIX for Dummies Questions & Answers 6 05-17-2007 03:46 PM
i want to delete a file based on existing file in a directory srivsn Shell Programming and Scripting 3 04-11-2006 05:38 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-08-2008
arunkumar_mca arunkumar_mca is offline
Registered User
  
 

Join Date: Oct 2004
Posts: 256
Based on the permision in the dir can i delete the file

All,

I am having a directory as

drwxrwsr-x 3 intermec intermec 10240 Jan 8 09:07 intermec

inside the directory . the files are like
cd
-rw-r----- 1 intrmc01 intermec 5226 Dec 2 15:03 AST07356.txt
-rw-r----- 1 intrmc01 intermec 5025 Dec 2 12:51 AST07363.txt
-rw-r----- 1 intrmc01 intermec 1607 Jan 2 16:17 AST08003.txt
-rw-r----- 1 intrmc01 intermec 7772 Jan 3 15:09 AST08004.txt
-rw-r----- 1 intrmc01 intermec 25125 Jan 4 14:57 AST08005.txt
-rw-r----- 1 intrmc01 intermec 20636 Jan 7 15:19 AST08008.txt

When i run the below command

find /intermec/ -name "*" -mtime +12 -exec rm -f -r 2> /dev/null "{}" ";"

The files are not deleted . it is showing as permision denied even though i have full permision on the directory . Why it is not removed .
Is that because files not having full permsion ???..

if yes can i over come that and remove the file by any other way ?..

but to note that i was also having a file inside the directory as
-rwxrwxrwx 1 intermec intermec 15209 Aug 1 16:27 AST07214.txt

i was not able to delete the is one also. What should i do in such a way that the files under the dirctory can be deleted

i know root will be able to remove . Apart from root can anyother can remove if so how can i found that.

Thanks,
Arun.

Last edited by arunkumar_mca; 01-08-2008 at 12:39 PM..
  #2 (permalink)  
Old 01-08-2008
awk awk is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 134
Assuming you can do this manually, try modifying your find statement to this

find /intermec/ -type f -mtime +12 -exec rm -f {} 2> /dev/null \;

the * was unnecessary because you want all files anyway
the -type limits you to files.

And while quoting the simicolon may work, I am in the habit of using the escape to signify characters.
  #3 (permalink)  
Old 01-08-2008
arunkumar_mca arunkumar_mca is offline
Registered User
  
 

Join Date: Oct 2004
Posts: 256
Thanks AWK . But no hope i says permision denied ..
  #4 (permalink)  
Old 01-08-2008
awk awk is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 134
Based on the directory information:

drwxrwsr-x 3 intermec intermec 10240 Jan 8 09:07 intermec


you must be either intermec, or part of the intermec group, to have permission to delete files. You can check your group priveledges by typing:

groups

I am not absolutely sure why the sticky bit in the directrory structure is set. - sorry.

The directory is open to the public - where they have read and search (able to change into the directory) but unable to create or delete files.
  #5 (permalink)  
Old 01-08-2008
arunkumar_mca arunkumar_mca is offline
Registered User
  
 

Join Date: Oct 2004
Posts: 256
thanks ..

Can u please confirm that if we change the directory permision like

drwxrwsrwx 3 intermec intermec 10240 Jan 8 09:07 intermec

will i be able to delete the files under the directory ??..

inside the directory the files has permsion like

-rw-r----- 1 intrmc01 intermec 5226 Dec 2 15:03 AST07356.txt
-rw-r----- 1 intrmc01 intermec 5025 Dec 2 12:51 AST07363.txt
-rw-r----- 1 intrmc01 intermec 1607 Jan 2 16:17 AST08003.txt
-rw-r----- 1 intrmc01 intermec 7772 Jan 3 15:09 AST08004.txt
-rw-r----- 1 intrmc01 intermec 25125 Jan 4 14:57 AST08005.txt
-rw-r----- 1 intrmc01 intermec 20636 Jan 7 15:19 AST08008.txt


also please help me know if i cahngethe permsion like i mentioned , will the delete operation can be performed by any user in any group ??..

will there file with above permision will be deleted .
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:49 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0