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

Top Page

Reply to this message
Author: Simon Reap
Date:  
To: Hampshire LUG Discussion List
New-Topics: Re: [Hampshire] Finding files not used in the last 365 days - A different idea using tar
Subject: Re: [Hampshire] Finding files not used in the last 365 days
On 08/05/07 14:58, Hugo Mills said the following:
>    Then something like this would work (but would create more
> directories than may be necessary):

>
> $ cd /home/admin/Marketing
> $ find -type d -print0 | xargs -0 mkdir -p
> $ find -type f -mtime 365 -exec mv "{}" "/mount/achieve/Marketing/{}"
>
>    Hugo.

>
>


Or, combining the read/exec versions, to reduce the number of
directories created:

$ cd /home/admin/Marketing
$ find . -type f -mtime 365 | while read nam
do
  namdir=$(dirname "$nam")
  if [ ! -d "$namdir" ]
  then
     mkdir -p "$namdir"
  fi
  mv "$nam" /mount/archive/marketing/"$nam"
done






This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.