|
Home > Archive > Unix Programming > April 2006 > Need a way to remove old files and the directory
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Need a way to remove old files and the directory
|
|
| astutesolutions@earthlink.net 2006-04-27, 7:56 am |
| Hi. It's been 8 years since I used Unix and need a way to remove files
older than 30 days including files deeper in the subdirectories. In
other words, from a parent directory down, I'd like to remove files
older than 30 days, including the directory if it is empty from the
file remove. Is there an easy way to do this?
I've searched this forum for this but only found out how to remove old
files in a specific directory.
FWIW, this is IBM/USS unix.
Thanks in advance.
Jeff
| |
| Eric Sosman 2006-04-27, 7:56 am |
|
astutesolutions@earthlink.net wrote On 04/20/06 13:49,:
> Hi. It's been 8 years since I used Unix and need a way to remove files
> older than 30 days including files deeper in the subdirectories. In
> other words, from a parent directory down, I'd like to remove files
> older than 30 days, including the directory if it is empty from the
> file remove. Is there an easy way to do this?
>
> I've searched this forum for this but only found out how to remove old
> files in a specific directory.
"man find" on how to remove the old files. To clean
up empty directories, I'd run a second, depth-first find
that just executed rmdir on each directory it encountered:
the rmdir will fail on any non-empty directories, and
succeed on those without any contents.
--
Eric.Sosman@sun.com
| |
| astutesolutions@earthlink.net 2006-04-27, 7:56 am |
| Thanks for the reply. I would try that, but I don't have access to the
system. Our unix admin is saying he has a tool that does this, but it
isn't working. I'm trying to pass on information to him on how to do
it. I know this is probably raising some eyebrows. Mine sure did.
I'd like to say, "here, try this!" Being a mainframe shop, I don't
know how good our unix admin truly is. I never met the guy, he's in
another office.
I can't access a directory with the ftp portion of my text editor
(ultraedit) because there are SO MANY files in there, mostly old ones.
And they are all in directories.
I did assume there would be 2 passes as you suggested. I should have
mentioned that.
Thanks.
| |
| Jim Cochrane 2006-04-27, 7:56 am |
| On 2006-04-20, astutesolutions@earthlink.net <astutesolutions@earthlink.net> wrote:
> Thanks for the reply. I would try that, but I don't have access to the
> system. Our unix admin is saying he has a tool that does this, but it
> isn't working. I'm trying to pass on information to him on how to do
> it. I know this is probably raising some eyebrows. Mine sure did.
> I'd like to say, "here, try this!" Being a mainframe shop, I don't
> know how good our unix admin truly is. I never met the guy, he's in
> another office.
>
> I can't access a directory with the ftp portion of my text editor
> (ultraedit) because there are SO MANY files in there, mostly old ones.
> And they are all in directories.
>
> I did assume there would be 2 passes as you suggested. I should have
> mentioned that.
>
> Thanks.
>
Sounds like your "UNIX admin" needs to hire a UNIX consultant; but if
you feel it's your duty to help him with this, it's pretty easy to
install a basic linux distro. or find a cheap or free UNIX/Linux service
provider and test it out yourself. Or ask your admin to give you access to
the system so that you can verify that your solution works.
--
*** Posted via a free Usenet account from http://www.teranews.com ***
| |
| astutesolutions@earthlink.net 2006-04-27, 7:56 am |
| Personally, I think he's just blowing off the problem. I have too
many other things to work on to get a linux/unix/aix environment and
experiment, but I appreciate the advice. I was hoping to remove his
ability to give the excuse.
| |
| Jim Cochrane 2006-04-27, 7:56 am |
| On 2006-04-20, astutesolutions@earthlink.net <astutesolutions@earthlink.net> wrote:
> Personally, I think he's just blowing off the problem. I have too
> many other things to work on to get a linux/unix/aix environment and
Unless, perhaps, you charge him a consulting fee :-)
(For those wondering about the lack of context - "him" refers to an
apparently needy "UNIX admin".)
> experiment, but I appreciate the advice. I was hoping to remove his
> ability to give the excuse.
>
NP (no problem)
--
*** Posted via a free Usenet account from http://www.teranews.com ***
|
|
|
|
|