FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora User

 
 
LinkBack Thread Tools
 
Old 04-02-2008, 03:06 PM
"Patrick O'Callaghan"
 
Default : Ho wto find files created on a specific date

On Wed, 2008-04-02 at 11:01 -0400, Todd Denniston wrote:
> Craig White wrote, On 04/02/2008 10:49 AM:
> > On Wed, 2008-04-02 at 10:40 -0400, Todd Denniston wrote:
> >
> >> cd /tmp
> >> touch --date="March 20" test20
> >> touch --date="March 21" test21
> >> find /opt/html/ -type f -newer test20 > list1
> >> find /opt/html/ -type f -newer test21 > list2
> > ----
> > nice...this is very elegant
> >
> > I need to file this away somewhere that I actually have a chance to find
> > this when I need it.
> >
> > Thanks
> >
> > Craig
> >
>
> and after seeing Mr. Haney's message I looked at the find man page a bit...
>
> find /opt/html/ -type f -newer test20 -not -newer test21
>
> same list as I got from the diff |grep, but without the need to sed, and it
> _probably_ could be carefully combined with the -exec option of find to do the rm.

I prefer xargs to -exec, since it executes the command in batches. Also,
since filenames may have spaces in them, it's a good idea to use -print0
in the find and -null in the xargs.

poc

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
 
Old 04-02-2008, 03:13 PM
Craig White
 
Default : Ho wto find files created on a specific date

On Wed, 2008-04-02 at 11:01 -0400, Todd Denniston wrote:
> Craig White wrote, On 04/02/2008 10:49 AM:
> > On Wed, 2008-04-02 at 10:40 -0400, Todd Denniston wrote:
> >
> >> cd /tmp
> >> touch --date="March 20" test20
> >> touch --date="March 21" test21
> >> find /opt/html/ -type f -newer test20 > list1
> >> find /opt/html/ -type f -newer test21 > list2
> > ----
> > nice...this is very elegant
> >
> > I need to file this away somewhere that I actually have a chance to find
> > this when I need it.
> >
> > Thanks
> >
> > Craig
> >
>
> and after seeing Mr. Haney's message I looked at the find man page a bit...
>
> find /opt/html/ -type f -newer test20 -not -newer test21
>
> same list as I got from the diff |grep, but without the need to sed, and it
> _probably_ could be carefully combined with the -exec option of find to do the rm.
>
> Open Source Scripting on the Fedora list.
----
open source scripting on the list is a good way to learn.

I tend to stay away from combo commands that are destructive for obvious
reasons and yes, though the 'exec' command would work, and I started
down the path, I know that I would prefer just to have a file list to
examine first and then just cat the list to the rm command as a measure
of safety.

What I have also found that learning to live with grep and sed is making
my life much easier rather than complicating it.

Craig

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
 
Old 04-02-2008, 03:16 PM
Craig White
 
Default : Ho wto find files created on a specific date

On Wed, 2008-04-02 at 10:36 -0430, Patrick O'Callaghan wrote:
> On Wed, 2008-04-02 at 11:01 -0400, Todd Denniston wrote:
> > Craig White wrote, On 04/02/2008 10:49 AM:
> > > On Wed, 2008-04-02 at 10:40 -0400, Todd Denniston wrote:
> > >
> > >> cd /tmp
> > >> touch --date="March 20" test20
> > >> touch --date="March 21" test21
> > >> find /opt/html/ -type f -newer test20 > list1
> > >> find /opt/html/ -type f -newer test21 > list2
> > > ----
> > > nice...this is very elegant
> > >
> > > I need to file this away somewhere that I actually have a chance to find
> > > this when I need it.
> > >
> > > Thanks
> > >
> > > Craig
> > >
> >
> > and after seeing Mr. Haney's message I looked at the find man page a bit...
> >
> > find /opt/html/ -type f -newer test20 -not -newer test21
> >
> > same list as I got from the diff |grep, but without the need to sed, and it
> > _probably_ could be carefully combined with the -exec option of find to do the rm.
>
> I prefer xargs to -exec, since it executes the command in batches. Also,
> since filenames may have spaces in them, it's a good idea to use -print0
> in the find and -null in the xargs.
----
I wouldn't expect file names in html directory to have spaces but
definitely it's always worth considering.

I don't much like single line complicated commands that achieve file
deletions as the ultimate result - for obvious reasons.

Craig

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
 

Thread Tools




All times are GMT. The time now is 08:46 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org