I think I've got it. Be *sure* to backup all your files before you try this, though.
In db.cgi, sub delete_records, change
($delete_list{$data[$db_key_pos]} = 0) : # then mark it deleted and don't print it to the new database.
($output .= $line . "\n"); # otherwise print it.
to
$path = "/path/to/directory";
$delete_list{$data[$db_key_pos]} = 0;
%rec = &array_to_hash(0,@data);
$directory = "$path/$rec{'Agency'}/$rec{'Town'}/$data[$auth_user_field]/$rec{'Category'}";
opendir (DIRECTORY, "$directory")
or &cgierr("unable to open directory in delete_records: $directory. Reason: $!");
@files = readdir(DIRECTORY);
close DIRECTORY;
foreach $file (@files) {
if ($file =~ /^$rec{'ID'}/) {
unlink ("$directory/$file")
}
}
}
else {
$output .= $line . "\n";
}
Be sure you set the $path variable to the full path to the main directory where your image files are. No trailing slash!!
It is set up so that an admin can delete the files, too, since it uses the userid from the record.
------------------
JPD
[This message has been edited by JPDeni (edited September 29, 1999).]

In db.cgi, sub delete_records, change
Code:
$delete_list{$data[$db_key_pos]} ? # if this id is one we want to delete ($delete_list{$data[$db_key_pos]} = 0) : # then mark it deleted and don't print it to the new database.
($output .= $line . "\n"); # otherwise print it.
to
Code:
if ($delete_list{$data[$db_key_pos]}) { $path = "/path/to/directory";
$delete_list{$data[$db_key_pos]} = 0;
%rec = &array_to_hash(0,@data);
$directory = "$path/$rec{'Agency'}/$rec{'Town'}/$data[$auth_user_field]/$rec{'Category'}";
opendir (DIRECTORY, "$directory")
or &cgierr("unable to open directory in delete_records: $directory. Reason: $!");
@files = readdir(DIRECTORY);
close DIRECTORY;
foreach $file (@files) {
if ($file =~ /^$rec{'ID'}/) {
unlink ("$directory/$file")
}
}
}
else {
$output .= $line . "\n";
}
Be sure you set the $path variable to the full path to the main directory where your image files are. No trailing slash!!
It is set up so that an admin can delete the files, too, since it uses the userid from the record.
------------------
JPD
[This message has been edited by JPDeni (edited September 29, 1999).]