Re: [Hampshire] Finding files not used in the last 365 days

Top Page

Reply to this message
Author: Brian Chivers
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] Finding files not used in the last 365 days
Hugo Mills wrote:
> On Tue, May 08, 2007 at 01:32:37PM +0100, Brian Chivers wrote:
>> Hugo Mills wrote:
>>> I think some sort of shell script or multi-stage process is going
>>> to be needed. Something like the following may work:
>>>
>>> $ cd /home/admin/Marketing
>>> $ find -type f -mtime 365 | sed -e s:/[^/]*$:: | sort -u | xargs mkdir -p
>>> $ find -type f -mtime 365 -exec mv {} /mount/achieve/Marketing/{}
>> So that would first create the directory structure then the second line
>> would do the actual moving.
>
>    Yes. Note that it won't work if you have spaces in the filenames.

>
>    Hugo.

>
>

Got round the space issue using the while loop and read

Like this

find ~ -name '* *' | while read FILE
do
         echo $FILE rocks.
done


:-)

Brian

------------------------------------------------------------------------------------------------
    The views expressed here are my own and not necessarily


                the views of Portsmouth College