Jump to content

Recommended Posts

Posted

Hey there

i have an applciation that gets files from an ftp server on a timer basis

but sometimes it imports the file while it's beeing written. which causes

problems, so i want to know if there's a way to know if the file is open

for writing or not at the time when i want to get it.

thanks


Posted (edited)

try opening for input with lock.

Open "c:\test.txt" for input lock Read as #1

and trap the error 70 that occurs if file is already open.

if it opens without error, close it and do your transfer.

Edited by dman
Posted

the file that i want to check is not local, it's the remote file on the ftp that i want to check. i am getting the file not sending it

i thougth about checking the size of the file 2 times in a row separated by 2-3 seconds, if the size is still the same then the file is still being written, and i try again after 5 minutes for example.

but my managers didn't like the idea saying that i would cause alot of checking and alot of resources used on the server. (but i don't think so :P)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...