>Thanks, but this is not working.
>Let me explain want I want to do.
>I have a bunch of files from differents folders that I want to copy.
>But, before copying thoses files, I want to check if anyone of theses file is in use.
>So this way, I can copy all the files.
>If I don't check, only the file that where not in use would be copyied...
>Basically, it's like a transaction and if an error occurs, I want to roll back the transaction.
>And, even if the file is open, I can still "re-open it" from VB.
>So, does anybody know a function, API, or way to check if a file is in
>use.
>
>Patrice Merineau
Even if you have the API that can check this, you will still have the same issue since it wouldn't do it for all the files you need to copy. If you need to rollback any copies if one file copy fails then just save the copied file names along with its destination so that you can remove them if one of them failed.
Or, check the files first and abort the processing if any one of them returns that it is open. This would have the drawback that a file that has been checked can be opened while the rest of the files are tested and thus the copy of that one will fail. Looks like a tricky one, let us know how it works out.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement