I have the multple upload mod on my database and the directory has has gotten so large that it takes forever if I need to FTP to the upload directory, so I'm attempting to split the upload directories up by 1000's. I've been successful so far up to a point. I can't seem to get the database to bring up a directory in the single or double digits (currently using 4 digits).
This is what I'm trying to do:
if (($form_upload_mod) && ($rec{$db_key} ge 1000) && ($rec{$db_key} lt 2000)) {
if (-e "$SAVE_DIRECTORY2/$rec{$db_key}") {
opendir (GRAPHIC, "$SAVE_DIRECTORY2/$rec{$db_key}") or &cgierr("unable to open directory: $SAVE_DIRECTORY2/$rec{$db_key}. Reason: $!");
@files = readdir(GRAPHIC);
closedir (GRAPHIC);
foreach $file (@files) {
next if ($file =~ /^\./); # Skip "." and ".." entries..
next if ($file =~ /^index/); # Skip index.htm type files..
++$num_files;
@stats = stat "$SAVE_DIRECTORY2/$rec{$db_key}/$file";
$prev_bytes +=$stats[7];
}
foreach $file (@files) {
next if ($file =~ /^\./); # Skip "." and ".." entries..
next if ($file =~ /^index/); # Skip index.htm type files..
print qq|<tr><td><$sizefont>Delete file</font>
<input type="checkbox" name="$file" value="delete"></td>
<td><img src= "$SAVE_DIRECTORY2_URL/$rec{$db_key}/$file"></td></tr>|;
}
}
that part of it works great as long as the ID number is between 1000 and 2000. But if I try to sort for anything under 1000 like this:
if (($form_upload_mod) && ($rec{$db_key} lt 1000)) {
I get nothing on any ID's less than 1000. For example, if I search for ID# 799, no files come up even though it's under 1000. If I change it to gt 5000, 799 will come up.
I don't know if this is a unix problem or perl problem with the way it sorts numbers, but is there a solution to this?
NOTE: I've tried this using the < sign in place of lt and it made no difference.
Thanks in advance!
Shannnon
This is what I'm trying to do:
if (($form_upload_mod) && ($rec{$db_key} ge 1000) && ($rec{$db_key} lt 2000)) {
if (-e "$SAVE_DIRECTORY2/$rec{$db_key}") {
opendir (GRAPHIC, "$SAVE_DIRECTORY2/$rec{$db_key}") or &cgierr("unable to open directory: $SAVE_DIRECTORY2/$rec{$db_key}. Reason: $!");
@files = readdir(GRAPHIC);
closedir (GRAPHIC);
foreach $file (@files) {
next if ($file =~ /^\./); # Skip "." and ".." entries..
next if ($file =~ /^index/); # Skip index.htm type files..
++$num_files;
@stats = stat "$SAVE_DIRECTORY2/$rec{$db_key}/$file";
$prev_bytes +=$stats[7];
}
foreach $file (@files) {
next if ($file =~ /^\./); # Skip "." and ".." entries..
next if ($file =~ /^index/); # Skip index.htm type files..
print qq|<tr><td><$sizefont>Delete file</font>
<input type="checkbox" name="$file" value="delete"></td>
<td><img src= "$SAVE_DIRECTORY2_URL/$rec{$db_key}/$file"></td></tr>|;
}
}
that part of it works great as long as the ID number is between 1000 and 2000. But if I try to sort for anything under 1000 like this:
if (($form_upload_mod) && ($rec{$db_key} lt 1000)) {
I get nothing on any ID's less than 1000. For example, if I search for ID# 799, no files come up even though it's under 1000. If I change it to gt 5000, 799 will come up.
I don't know if this is a unix problem or perl problem with the way it sorts numbers, but is there a solution to this?
NOTE: I've tried this using the < sign in place of lt and it made no difference.
Thanks in advance!
Shannnon