PDA

View Full Version : how to delete a file?



whoops.slo
20th November 2006, 14:18
Hi!

I am downloading several files from the Internet using http->get(). Sometimes I get empty file (either because of a server timeout, wrong URL, port blocking, strange rewrite rules on the server,...). When I close the application I set to delete all the downloaded files and remove the dir. where I saved them. But those files with zero size can not be deleted. It seems they are not closed. How can I close them? Simple file.close() does not work.

e8johan
20th November 2006, 17:58
Are you sure that they are empty and not placeholders for files that your application still is trying to fetch?

whoops.slo
20th November 2006, 22:55
I do not know. The program is definitely trying to fill them, since they are open. Since the http->get() in those cases failed they are not closed and I can not delete them. Is there anything I can do?
Regards,
Luka

manivannan_1984
21st November 2006, 09:39
R u downloading one file at a time? If so, before start downloading next file, check the previous download whether its failed or timeout, then close your file... Then will start download the next one...


Thanks,
Mani

whoops.slo
22nd November 2006, 14:27
It should download only one file at the time but the request for new file are sent after the header is received, therefore it is possible to download several files at the same time... If the file is received successfully then the file is closed, but if it fails it stays open... I was hoping there is some way to close or abort writing to it in some way. If somebody has an idea that would be great! Otherwise thanks to all that replied!

Regards,
Luka