From owner-freebsd-questions@FreeBSD.ORG Sat Jun 7 03:15:42 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 752FC1065671 for ; Sat, 7 Jun 2008 03:15:42 +0000 (UTC) (envelope-from frank@esperance-linux.co.uk) Received: from mailout.zetnet.co.uk (mailout.zetnet.co.uk [194.247.47.231]) by mx1.freebsd.org (Postfix) with ESMTP id 11DE78FC18 for ; Sat, 7 Jun 2008 03:15:41 +0000 (UTC) (envelope-from frank@esperance-linux.co.uk) Received: from irwell.zetnet.co.uk ([194.247.47.48] helo=zetnet.co.uk) by mailout.zetnet.co.uk with esmtp (Exim 4.63) (envelope-from ) id 1K4ou1-0000LH-JC; Sat, 07 Jun 2008 04:15:37 +0100 Received: from melon.esperance-linux.co.uk (54-144.adsl.zetnet.co.uk [194.247.54.144]) by zetnet.co.uk (8.14.1/8.14.1/Debian-9) with ESMTP id m573FaOb029426; Sat, 7 Jun 2008 04:15:36 +0100 Received: by melon.esperance-linux.co.uk (Postfix, from userid 1001) id 12597FCA4AF; Sat, 7 Jun 2008 04:15:31 +0100 (BST) Date: Sat, 7 Jun 2008 04:15:31 +0100 From: Frank Shute To: Georgi Tyuliev Message-ID: <20080607031531.GA84969@melon.esperance-linux.co.uk> Mail-Followup-To: Georgi Tyuliev , freebsd-questions@freebsd.org References: <48497315.5020804@bas.bg> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <48497315.5020804@bas.bg> User-Agent: Mutt/1.4.2.3i X-Face: *}~{PHnDTzvXPe'wl_-f%!@+r5; VLhb':*DsX%wEOPg\fDrXWQJf|2\,92"DdS%63t*BHDyQ|OWo@Gfjcd72eaN!4%NE{0]p)ihQ1MyFNtWL X-Operating-System: FreeBSD 6.3-RELEASE-p2 i386 X-Organisation: 'Esperance Linux' X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (zetnet.co.uk [194.247.46.1]); Sat, 07 Jun 2008 04:15:36 +0100 (BST) Cc: freebsd-questions@freebsd.org Subject: Re: change the file date and time X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Frank Shute List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Jun 2008 03:15:42 -0000 On Fri, Jun 06, 2008 at 08:25:41PM +0300, Georgi Tyuliev wrote: > > Dear Sirs > 1. How to mount Sony Ericsson k750i mobile phone with FreeBSD 7.0 ? Plug it in and see what shows up in /var/log/messages. Then read the handbook: http://www3.uk.freebsd.org/doc/en_US.ISO8859-1/books/handbook/usb-disks.html > 2. How to change automatically the file attributes (for example > 'date') of large number of files? For example: I have taken many > photos with my Sony Ericsson k750i mobile phone and the exact time > end date is accessible (e.g. through F3 of the midnight commander), > but very often when copying the jpg's the file attributes change. If you're lucky, the jpg's will contain exif info which if the phone's time & date is set will tell you when the picture was taken amongst other things. This is more reliable than depending on file date. Here's a quick & dirty perl script (called picinfo) that I used to get this data (modify at your will): <------------> #!/usr/bin/perl -w # # Print tab delimited exif data from an image file suitable for # insertion into a DB. # # Takes file as arg. # # Usage example: # # $ for file in $(ls | grep 'jpg');do # $ picinfo $file >> ~/data.txt # $ done use Image::Info qw(image_info); # Get exif data as a hash my $info = image_info($ARGV[0]); # Pic mangled or exif data doesn't exist if (my $error = $info->{error}) { die "Can't parse image info: $error\n"; } # Get data from hash my $my_date = $info->{DateTimeOriginal}; # iso format date/time. my $my_exptime = $info->{ExposureTime}; # reciprocal of speed in secs # as a rational no. my $my_fstop = $info->{FNumber}; # fstop as a rational no. my $my_asa = $info->{ISOSpeedRatings}; # ASA # Grab date my $the_date = substr($my_date, 0, 10); # Grab time my $the_time = substr($my_date, -8); # Doh! Camera date/time not set. if ($the_date eq "0000:00:00") { $the_date = "N/K"; } if ($the_time eq "00:00:00") { $the_time = "N/K"; } # Call sub-funcs $my_fstop = fstop(); $my_exptime = speed(); print "$ARGV[0]\t$the_date\t$the_time\t$my_exptime\tF$my_fstop\t$my_asa\n"; ###___SUBS___### sub fstop{ $my_fstop =~ s/\/10//; $my_fstop = $my_fstop/10; return $my_fstop; } sub speed{ my $divisor = $my_exptime; my $numerator = $my_exptime; $divisor =~ s/[0-9]+\/([0-9]+)/$1/; $numerator =~ s/([0-9]+)\/[0-9]+/$1/; #print "divisor = $divisor\n"; #print "num = $numerator\n"; $my_exptime = $numerator/$divisor; # Calc exposure in decimal my $exposure = 0; # Horrendous case statement. Is there a better way to do this? SWITCH: { if ($my_exptime <= 0.00033) { $exposure = "< 1/3000"; last SWITCH; } if ($my_exptime <= 0.0005) { $exposure = "1/2000"; last SWITCH; } if ($my_exptime <= 0.001) { $exposure = "1/1000"; last SWITCH; } if ($my_exptime <= 0.00125) { $exposure = "1/800"; last SWITCH; } if ($my_exptime <= 0.00167) { $exposure = "1/600"; last SWITCH; } if ($my_exptime <= 0.002) { $exposure = "1/500"; last SWITCH; } if ($my_exptime <= 0.0025) { $exposure = "1/400"; last SWITCH; } if ($my_exptime <= 0.0033) { $exposure = "1/300"; last SWITCH; } if ($my_exptime <= 0.005) { $exposure = "1/200"; last SWITCH; } if ($my_exptime <= 0.01) { $exposure = "1/100"; last SWITCH; } if ($my_exptime <= 0.0167) { $exposure = "1/60"; last SWITCH; } if ($my_exptime <= 0.033) { $exposure = "1/30"; last SWITCH; } if ($my_exptime <= 0.05) { $exposure = "1/20"; last SWITCH; } if ($my_exptime <= 0.0625) { $exposure = "1/16"; last SWITCH; } if ($my_exptime <= 0.125) { $exposure = "1/8"; last SWITCH; } if ($my_exptime <= 0.25) { $exposure = "1/4"; last SWITCH; } if ($my_exptime <= 0.5) { $exposure = "1/2"; last SWITCH; } if ($my_exptime <= 1) { $exposure = "1"; last SWITCH; } if ($my_exptime <= 2) { $exposure = "2"; last SWITCH; } $exposure = "> 2"; } return $exposure; } <------------> Last time I used it, it worked. You'll have to have graphics/p5-Image-Info installed though. > Best regards, > G.Tyuliev Regards, -- Frank Contact info: http://www.shute.org.uk/misc/contact.html