On Fri, Apr 16, 2010 at 02:19:47PM -0700, Richard Elling wrote:
> On Apr 16, 2010, at 1:37 PM, Nicolas Williams wrote:
> > I've a ksh93 script that lists all the snapshotted versions of a file...
> > Works over NFS too.
> > 
> > % zfshist /usr/bin/ls
> > History for /usr/bin/ls (/.zfs/snapshot/*/usr/bin/ls):
> > -r-xr-xr-x   1 root     bin        33416 Jul  9  2008 
> > /.zfs/snapshot/install/usr/bin/ls
> > -r-xr-xr-x   1 root     bin        37612 Nov 21  2008 
> > /.zfs/snapshot/2009-12-07-20:47:58/usr/bin/ls
> > -r-xr-xr-x   1 root     bin        37612 Nov 21  2008 
> > /.zfs/snapshot/2009-12-01-00:42:30/usr/bin/ls
> > -r-xr-xr-x   1 root     bin        37612 Nov 21  2008 
> > /.zfs/snapshot/2009-07-17-21:08:45/usr/bin/ls
> > -r-xr-xr-x   1 root     bin        37612 Nov 21  2008 
> > /.zfs/snapshot/2009-06-03-03:44:34/usr/bin/ls
> > % 
> > 
> > It's not perfect (e.g., it doesn't properly canonicalize its arguments,
> > so it doesn't handle symlinks and ..s in paths), but it's a start.
> 
> There are some interesting design challenges here.  For the general case, you 
> can't rely on the snapshot name to be in time order, so you need to sort by 
> the
> mtime of the destination.  

I'm using ls -ltr.

> It would be cool to only list files which are different.

True.  That'd not be hard.

> If you mv a file to another directory, you might want to search by filename
> or a partial directory+filename.

Or even inode number.

> Or maybe you just setup your tracker.cfg and be happy? 

Exactly.

Nico
-- 
_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to