ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Excuse my ignorance, but what programming language
are we looking at here? If stat is anything similar to
"C in Linux environments" here you're picking the wrong
fields from the structure (assuming that (stat ($file))[8,9]
gets field 8 and 9) ...
i got it, it is working now, i changed the code. however i require some assistance in another side of the script, are you good in perl and db. i hope so as i really need some help.
ok, i will give it a try, i really appreciate your help
i have this script that i would like to take image information from a directory namely /home/me/images/. the information i would like the script to take is the name, size and date, and insert these data into MySQL. Basic, but i have had alot of problems doing it.
---------------------------------
#!/usr/bin/perl -w
use strict;
use DBI;
use Date::Manip;
############################################################################
####
# Connect to Database Named cctvimages on the localhost with the root user
# $dbh=DBI->connect(DBI:mysql;$database", $user, $password);
############################################################################
####
my $dbh = DBI->connect("DBI:mysql:dbname=cctvimages;host=localhost",
"root", "mel", {'RaiseError' => 1});
my $file;
my $size;
my $mtime;
my $secs;
my $dir = '/home/me/images';
my @jpegs = `ls *.jpg`;
foreach (@jpegs) {
print"$_"; # dont forget that a newline is still at the end of each element in the array...
}
_________________________
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/httpd/htdocs/php/search2.php on line 14
Sorry, no records were found!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.