View Full Version : using file_kill
sandyrepope
01-04-2007, 19:35
I know that this is a minor issue but I'd really like to know before I try using the file_kill command. What exactly does the command do? Does it delete a file immediately or does it send the file to the recycle bin?
I really do think the help file should have something about this in it but it doesn't.
Thanks
Sandy
Petr Schreiber
01-04-2007, 19:48
Hi,
according to my test FILE_KILL really immediately deletes file, no moving to recycle bin.
Do you need recycle bin functionality ?
Bye,
Petr
ErosOlmi
01-04-2007, 19:57
Hi Sandy,
like Petr suggested, FILE_KILL (http://www.thinbasic.com/public/products/thinBasic/help/html/file_kill.htm) immediatelly delete the file name passed as argument.
To be able to delete the file, file must not be opened by any other process, local or remote.
Do you need some recicle bin facility?
Ciao
Eros
sandyrepope
01-04-2007, 20:17
My main concern was that while testing this command I might delete something thinking I could get it back. Now that I know I couldn't I know to be very careful when using the file_kill.
I hadn't thought about it but now that Psch ask about it. It wouldn't hurt to have something that would move the file to the recycle bin. Usually during my computing I delete things but I always just send these files to the recycle bin just in case I change my mind about a file and want to get it back.
I just wonder if a file couldn't be moved to the recycle bin with script code (maybe use file_copy?) and then delete it from it's original location? It would be kind of nice to have some kind of safety in place. I've found that even I sometime delete the wrong thing.
Thanks
Sandy
Michael Hartlef
01-04-2007, 21:18
I thought recyle bin is just a file property, or?
sandyrepope
02-04-2007, 01:26
I thought recyle bin is just a file property, or?
I always thought it was just a folder that the files got moved to but now I'm not sure. I think we should wait for someone who knows about the recycle bin to post a reply.
I'm not going to try anything until we find out more about it. I don't want to mess anything up by doing something wrong.
Thanks
Sandy
Michael Hartlef
02-04-2007, 08:19
Here is some delphi code, taken from here:
http://www.delphitricks.com/source-code/files/move_a_file_in_the_recycle_bin.html
uses ShellAPI;
function MoveToRecycle(sFileName: string): Boolean;
var
fos: TSHFileOpStruct;
begin
FillChar(fos, SizeOf(fos), 0);
with fos do
begin
wFunc := FO_DELETE;
pFrom := PChar(sFileName);
fFlags := FOF_ALLOWUNDO or FOF_NOCONFIRMATION or FOF_SILENT;
end;
Result := (0 = ShFileOperation(fos));
end;
I used google to find it with move file recycle bin code
RobertoBianchi
02-04-2007, 09:41
Added FILE_ShellCopy() and FILE_ShellDelete() functions to the thinbasic_File.dll module.
You'll find this update in the next release.
Regards,
Roberto
ErosOlmi
02-04-2007, 15:06
New functions present in latest thinBasic preview 1.3.0.1
Regards
Eros
Michael Hartlef
02-04-2007, 15:10
That was quick!