Para detectar si un pendrive se desconecta te recomiendo que hagas algo asi:
Código Delphi
[-]
function DrivePreparado(Drive: Char): Boolean;
var
ErrorMode: word;
begin
if Drive in ['a'..'z'] then Dec(Drive, $20);
if not (Drive in ['A'..'Z']) then
raise EConvertError.Create('Drive inválido');
ErrorMode := SetErrorMode(SEM_FailCriticalErrors);
try
if DiskSize(Ord(Drive) - $40) = -1 then
Result := False
else
Result := True;
finally
SetErrorMode(ErrorMode);
end;
end;
Con la función GetDriveType detectas la unidad usb, y con esta funcion compruebas si la unidad esta lista para ser usada. Por ejemplo pones un timer que pase esta funcion cada x tiempo y si result:=false borras las imagenes.
Espero haberte ayudado.
Salu2