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

Top Page
Author: Hugo Mills
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] Finding files not used in the last 365 days

Reply to this message
gpg: failed to create temporary file '/var/lib/lurker/.#lk0x56df3100.hantslug.org.uk.30108': Permission denied
gpg: keyblock resource '/var/lib/lurker/pubring.gpg': Permission denied
gpg: Signature made Tue May 8 14:58:39 2007 BST
gpg: using DSA key B2C27BC21C335860
gpg: Can't check signature: No public key
On Tue, May 08, 2007 at 02:33:32PM +0100, Brian Chivers wrote:
> 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.
>
> Ah, spaces in file names will be an issue as the user who uses this
> directory is a "boo hisss" Mac person :-/


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.

-- 
=== Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk ===
  PGP key: 1C335860 from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
             --- Happiness is mandatory.  Are you happy? ---