[ale] When a script is necessary, and when a piped command is sufficient ?

Jim Popovitch jimpop at yahoo.com
Wed Mar 15 09:53:53 EST 2006


Courtney Thomas wrote:
> I've been trying to assemble a sequence of actions, e.g. find, sort, rm, 
> etc.... to filter a directory of files and have not yet succeeded.
> 
> In particular I need to execute, in the following sequence;
> 
> 	1-find or ls
> 	2-sort [by file date]
> 	3-rm [interactively]
> 

First, man find and read up on ctime/atime/mtime to see if they will do 
for what you need.

    find /path/to/somewhere -type f -ctime 4 -exec rm {} \;

or this for non-interactive removes:

    find /path/to/somewhere -type f -ctime 4 -exec rm -f {} \;


-Jim P.





More information about the Ale mailing list