From owner-freebsd-hackers@FreeBSD.ORG Thu Jul 1 21:09:03 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D38E11065678 for ; Thu, 1 Jul 2010 21:09:03 +0000 (UTC) (envelope-from rwmaillists@googlemail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 334EC8FC16 for ; Thu, 1 Jul 2010 21:09:02 +0000 (UTC) Received: by wyb34 with SMTP id 34so1943400wyb.13 for ; Thu, 01 Jul 2010 14:08:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:subject :message-id:in-reply-to:references:x-mailer:mime-version :content-type:content-transfer-encoding; bh=a6OYXjYtSwrLuszHAcs8gdARl/dE+KcQwauP3gNiLyE=; b=qVXXoFzBzJo7XkkLLNLjiG4reM9THXX3seKaWfpxUp5lN5HkZTHaWMD62nt5G80vhD J9hjtgFVREqKSuD5gIKDPh4hpujmxyjvwYCT+S2uKCFX/ijnlfpL+C17wA17jRY7u2pc om5XoqvANnWut2c/ss19jFjZiCa5YJb6QHbUk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=date:from:to:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type:content-transfer-encoding; b=eIZ+ARbINQu3ShS5E9mtpq8T4uD740BRHD0R0zDArN0eF+4C1nzJ/kUWuvUxa4i58r Kj7AxLXcchoDwsU1JRLrsd7qYRQbpXvPp7gte2MxUyds9MT/Ts+5QIQnmJckJgpqWpq7 cri3UdKAMJJDrkfj5635HnOB7gfjh+hz93iTs= Received: by 10.213.14.15 with SMTP id e15mr37502eba.62.1278018538137; Thu, 01 Jul 2010 14:08:58 -0700 (PDT) Received: from gumby.homeunix.com (bb-87-81-140-128.ukonline.co.uk [87.81.140.128]) by mx.google.com with ESMTPS id v8sm638848eeh.2.2010.07.01.14.08.57 (version=SSLv3 cipher=RC4-MD5); Thu, 01 Jul 2010 14:08:57 -0700 (PDT) Date: Thu, 1 Jul 2010 22:08:55 +0100 From: RW To: freebsd-hackers@freebsd.org Message-ID: <20100701220855.70d74b03@gumby.homeunix.com> In-Reply-To: References: X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; i386-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: thoughts on sorting files into sub-folders by access date? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jul 2010 21:09:03 -0000 On Thu, 1 Jul 2010 10:20:25 -0700 Steve Franks wrote: > Hi y'all, > > My high-end point&shoot camera likes to glob all my photos in a single > folder, and it's glutting up my drive, and makes finding a specific > trip unpleasant, with no good place for metadata. My SLR sorts them > into folders by date, which I love. > > ... > I thought I'd check if there's some trivially simple way of doing this > with bash & find first. > If the timestamps are acccurate you could simply loop around the files and do something like this (untested): dir="${targetdir}/`stat -f %Sm -t %Y%m%d ${file}`/" [ -d "${dir}"] || mkdir "${dir}" mv "${file}" "${dir}"]