PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → fListFile fDelete fFileExists issue WD18
fListFile fDelete fFileExists issue WD18
Iniciado por guest, 16,mar. 2015 16:25 - 2 respuestas
Publicado el 16,marzo 2015 - 16:25
Hi Guys

OK, got a little issue with a service I've written that watches a folder for inbound text files and imports them into a database.

I use fListFile to get a string from which I build an array of files to process
I use fOpen with foReadWrite + foReadLock + foWriteLock so that theoretically, no other program can access it while I'm reading the data.

When the data is successfully processed, I fClose then use fDelete to temove it.

This code has been running since about WD12

I now have an issue where I am importing 2 copies of the file into the database.

Adding some extra debug code with additional fListFile after processing, the file is initially correctly gone ( and fFileExist is false). However milliseconds later another fListFile finds it again!

I have tried modifying the code to rename and delete the renamed file, which again reports success, but the file(s) still mysteriously appear.

Anyone else have similar issues?

I am about to try deleting via ExeRun or API and see what happens.
Also, I might put a pause in the looping, but would like to avoid this as performance is a factor.

Cheers

Malc
Publicado el 16,marzo 2015 - 17:14
Hi Malc,

Try to consider some issues:

1) After executing fDelete, the operative system take some time to delete the file (maybe you need to increase the duration between cals?);
2) Try to use fdir to get the files in the directory. By experince, I know it is a lot faster;

Bruno
Publicado el 16,marzo 2015 - 17:39
OK, tried ExeRun and fFileExist to check deletion. Still re-appears.

I'm guessing something has changed on the server re caching or file indexing or something which is flushing the file back to disk

Next step is a pause in the loop <img src="/NG2013_WEB/ui/smiley/2.gif" align=absmiddle border=0 alt=":(">