Re: change the file date and time

2008-06-08 Thread Lowell Gilbert
Frank Shute [EMAIL PROTECTED] writes:

 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):

I would recommend graphics/jhead.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: change the file date and time

2008-06-07 Thread Ian Smith
On Fri, 06 Jun 2008 20:25:41 +0300 Georgi Tyuliev [EMAIL PROTECTED] wrote:

  1. How to mount Sony Ericsson k750i mobile phone with FreeBSD 7.0 ?

No idea.

  2. How to change automatically the file attributes (for example 'date') 
  of large number of files?

For modification and/or access times, use touch(1)
For user:group ownership, use chown(1)
For file modes, use chmod(1)

  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.

To preserve user/group ownership and modification/access timestamps on
files, use cp(1) with the -p flag.  Maybe mc doesn't do that correctly
on copying, though it should for a move, assuming that it uses mv(1)

cheers, Ian

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


change the file date and time

2008-06-06 Thread Georgi Tyuliev

Dear Sirs
1. How to mount Sony Ericsson k750i mobile phone with FreeBSD 7.0 ?
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.
Best regards,
G.Tyuliev
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]

Re: change the file date and time

2008-06-06 Thread Bill Campbell
On Fri, Jun 06, 2008, Georgi Tyuliev wrote:
Dear Sirs
1. How to mount Sony Ericsson k750i mobile phone with FreeBSD 7.0 ?
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.

man utime
man touch

You can set the access and modification times of any file or
directory directly with the utime(2) system call.  This can be
done from scripting languages such as python or perl, without
having to write C programs.

The ``touch'' command can change the modification times from any
shell program, which may be all you need.

Bill
-- 
INTERNET:   [EMAIL PROTECTED]  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
Voice:  (206) 236-1676  Mercer Island, WA 98040-0820
Fax:(206) 232-9186

Intaxication: Euphoria at getting a refund from the IRS, which lasts until
you realize it was your money to start with.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: change the file date and time

2008-06-06 Thread Frank Shute
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 :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