Computing.Net > Forums > Unix > Remove files command

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Remove files command

Reply to Message Icon

Name: nimi
Date: October 24, 2007 at 20:18:57 Pacific
OS: Unix
CPU/Ram: na
Product: na
Comment:

Hi,

I am trying to remove 30 days file from the templog directory by executing the following command but it says /usr/dt/bin/: Permission denied.

`find /omcgen/metrica/DRI/templog -mtime +30 -exec rm {} \\;`;

What other commands can I use besides this one?

Thanks

Nimi



Sponsored Link
Ads by Google

Response Number 1
Name: japh
Date: October 24, 2007 at 23:43:44 Pacific
Reply:

The command itself looks fine, but you should leave out the backquotes:

find /omcgen/metrica/DRI/templog -mtime +30 -exec rm {} \;

(all on one line)

This will search for all files in the directory /omcgen/metrica/DRI/templog and below that haven't been modified for more than 30 days and remove them.

But: you will get error messages when you try to delete directories and when you try to remove files that you have no authorization for. Use find's option "-type f" to search for regular files only and rm's option -f to try extra hard to remove the files.

find /omcgen/metrica/DRI/templog -type f -mtime +30 -exec rm -f {} \;


This message was produced with 100% recycled electrons


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Remove files command

Unix script remove files older 1mon www.computing.net/answers/unix/unix-script-remove-files-older-1mon/5971.html

removing files / match criteria www.computing.net/answers/unix/removing-files-match-criteria/7858.html

rerieving removed file www.computing.net/answers/unix/rerieving-removed-file/6066.html