mel awaisi wrote:
> Hi,
> 
> The problem has been highlighted to me by a great person in this
> list, but i just cant solve it.
> 
> I have this script that is not working as it should be. this is what
> it is supposed to be doing, take images from a directory (images are
> coming from camera) and renames them with the date and time of image.
> then insert some meta information into MySQL. what the script is
> supposed to be doing is to always keep looking and whenever it finds
> images to perform the change and insert. the output is as follow: it
> only does the process once. 
> 
> i would appreciate any help.
> 
> cheers,
> Mel
> 
> 
> -----------
> renaming /home/httpd/htdocs/image.jpg to
> /home/me/images/2003_03_24_18_14_12.jpg
> adding /home/me/images/2003_03_24_18_14_12.jpg to database
> [EMAIL PROTECTED] cgi-bin]# size is 196378
> modified is 20030324181412
> filename is 2003_03_24_18_14_12.jpg
> Use of uninitialized value in concatenation (.) or string at
> renamerr.pl line 99
> .
> Failed to get the info
> $file is: at renamerr.pl line 99.
> -----------------
> 
> The script is as follow:
> ----------------
> 
> #!/usr/bin/perl
> 
> use strict;
> use warnings;
> 
> use DBI;
> use Date::Manip;
> 
> =head1 NAME # renamer - renames files received by ftp, moving them to
> a new directory
> 
> =head1 SYNOPSIS
> 
> nohup ./renamer image /home/httpd/htdocs /home/me/images jpg
> renamer.process &
> 
> =head1 DESCRIPTION
> 
> #The above instructs renamer to look for files called image.jpg in
> /home/httpd/htdocs.It checks once per minute for such a file to
> appear. If it sees a
> #readable file called /home/httpd/htdocs.jpg it moves it
> to/home/httpd/htdocs/image.200302251530.jpg where the number is a
> #time stamp with year (four digits), month, day of the month, hour
> (in24 mode), and minute.
> #Read the bugs section closely.
> 
> =head1 BUGS
> 
> #The original and new directories must be on the same file system.The
> program probably does not work on windows systems.
> #The daemon behavior is weak.Not much testing has been done, so the
> script may have other problems.
> 
> =cut
> 
> my $usage = <<EOUSAGE;
> usage: $0 initial_name original_dir new_dir suffix lockfile
> example: $0 pic /home/httpd/htdocs /home/me/images jpg
> /home/me/renamer.process
> EOUSAGE
> 
> my $check_file = shift or die $usage;
> my $original_dir = shift or die $usage;
> my $new_dir = shift or die $usage;
> my $suffix = shift or die $usage;
> my $lockfile = shift or die $usage;
> 
> 
> ##################################
> # If you put it into the cron, comment out between the START and END
> BLOCK, and uncomment the section below it so you don't get multiple
> copies running. Also, comment out the
> # lockfile bits above.
> 
> #START BLOCK
> exit if (fork());
> 
> while (-e "$lockfile") {
> process($check_file) if (-r "$original_dir/$check_file.$suffix");
        You get the original file and if readable do the processing, but nowhere do 
you open the dir to read (I make this assumption since you use name initial_name for 
your vairable.) So you would need to either read the dir and process through the 
directory pulling all files which are egual to or greater than the initial file given. 
Then you would need to know when done, so you can remove the lock file.

Wags ;)


**********************************************************
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
****************************************************************


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to