Delete all but latest "X" files per directory?

21 views
Skip to first unread message

James Johnson

unread,
Sep 20, 2012, 7:56:50 PM9/20/12
to skulker2...@googlegroups.com
I have a set of directories that I can match with the pattern /foo/bar/<project>/<env>/<project>. What I need to do is delete all but the newest "X" from each directory that is a leaf-node.

When I do this:

<rule
    n="10"
    type="delete"
    match_type="file"
    match_pattern="/foo/bar/.../^.*\.tgz$”
    match_pattern_limit=”-3”
    match_pattern_limit_by=”age”
/>

it seems to find all files across all directories (except for the three newest). There are cases where I need that but also cases where I need to treat each directory individually.

Thoughts?

Simon Edwards

unread,
Sep 21, 2012, 9:25:04 AM9/21/12
to skulker2...@googlegroups.com

Hi James,
This requires a small change to the code to work as expected. I will push the code later.

Regards,
Simon.

> --
> You received this message because you are subscribed to the Google Groups "skulker2-discuss" group.
> To view this discussion on the web, visit https://groups.google.com/d/msg/skulker2-discuss/-/1ZyfYnYyOnUJ.
> To post to this group, send an email to skulker2...@googlegroups.com.
> To unsubscribe from this group, send email to skulker2-discu...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/skulker2-discuss?hl=en-GB.

James Johnson

unread,
Sep 30, 2012, 6:10:59 PM9/30/12
to skulker2...@googlegroups.com
Hi Simon,

Sorry I haven't had a chance to get back to you. Did you get a chance to look at this?

Thanks,
James

Simon Edwards

unread,
Oct 1, 2012, 2:48:50 AM10/1/12
to skulker2...@googlegroups.com

Hi James. Yes - updated package on Google code with new rule option group_by_directory.

Regards,
Simon

To view this discussion on the web, visit https://groups.google.com/d/msg/skulker2-discuss/-/mOOk69l9AM0J.
Reply all
Reply to author
Forward
0 new messages