Linux-admin Development Archive on lore.kernel.org
 help / color / mirror / Atom feed
* simple scripting question
@ 2003-01-27  9:58 urgrue
  2003-01-27 13:06 ` Glynn Clements
  2003-01-28  2:03 ` Mikhail Romanenko
  0 siblings, 2 replies; 3+ messages in thread
From: urgrue @ 2003-01-27  9:58 UTC (permalink / raw)
  To: linux-admin

i have several dirs and i want to delete the ones that are older than 
60 days.
currently im doing it like this:
find /path/backups-*  -type d -mtime +60 | xargs rm -r

but i dont want to go through the CONTENTS of the dirs and delete every 
individual file that is older than 60d. i want to either delete or not 
delete the whole dir depending on its timestamp.

but i only know of find that accepts something as spiffy as -mtime +60, 
and i cant find any options for it like "--non-recursive".

any suggestions?
basically this is for removing outdated backups.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: simple scripting question
  2003-01-27  9:58 simple scripting question urgrue
@ 2003-01-27 13:06 ` Glynn Clements
  2003-01-28  2:03 ` Mikhail Romanenko
  1 sibling, 0 replies; 3+ messages in thread
From: Glynn Clements @ 2003-01-27 13:06 UTC (permalink / raw)
  To: urgrue; +Cc: linux-admin


urgrue wrote:

> i have several dirs and i want to delete the ones that are older than 
> 60 days.
> currently im doing it like this:
> find /path/backups-*  -type d -mtime +60 | xargs rm -r
> 
> but i dont want to go through the CONTENTS of the dirs and delete every 
> individual file that is older than 60d. i want to either delete or not 
> delete the whole dir depending on its timestamp.
> 
> but i only know of find that accepts something as spiffy as -mtime +60, 
> and i cant find any options for it like "--non-recursive".

	find <dirs> -type d -mindepth 1 -maxdepth 1

will find exactly those directories whose parent is one of <dirs>.

-- 
Glynn Clements <glynn.clements@virgin.net>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: simple scripting question
  2003-01-27  9:58 simple scripting question urgrue
  2003-01-27 13:06 ` Glynn Clements
@ 2003-01-28  2:03 ` Mikhail Romanenko
  1 sibling, 0 replies; 3+ messages in thread
From: Mikhail Romanenko @ 2003-01-28  2:03 UTC (permalink / raw)
  To: urgrue; +Cc: linux-admin

27.01.03 14:58:28, urgrue <urgrue@tumsan.fi> wrote:

>i have several dirs and i want to delete the ones that are older than 
>60 days.
>currently im doing it like this:
>find /path/backups-*  -type d -mtime +60 | xargs rm -r
>
>but i dont want to go through the CONTENTS of the dirs and delete every 
>individual file that is older than 60d. i want to either delete or not 
>delete the whole dir depending on its timestamp.
>
>but i only know of find that accepts something as spiffy as -mtime +60, 
>and i cant find any options for it like "--non-recursive".
>
Why cannot you use -maxdepth 0 option?

liana:~$ man find
[...]
       -maxdepth levels
              Descend  at  most  levels  (a  non-negative integer) levels of
              directories below the command line arguments.   `-maxdepth  0'
              means  only  apply  the  tests and actions to the command line
              arguments.
[...]

Mikhail




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-01-28  2:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-27  9:58 simple scripting question urgrue
2003-01-27 13:06 ` Glynn Clements
2003-01-28  2:03 ` Mikhail Romanenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox