Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 FSO.FileExists(strMyFile)

Author  Topic 

Jay99

468 Posts

Posted - 2002-03-19 : 09:17:13
I have a SQL 7 Job with an ActiveX step written in VBScript. It goes a little something like this....

while not fso.FileExists(strMyFile)
ChillOutAndDrinkABeer
wend


The next step in the job, pumps the data in the file into my database.

My question is this: Will the FileExists method return TRUE before ALL of the file is in the directory? These will be very large files that some other system will be copying into the directory. If I start the next step before the move completes, I assume I will get a error.

Jay
<O>


EDIT: See I don't know exactly when the files will be showing up in the directory I am looking at, so the job is scheduled to start and needs to wait for the file . . .

Edited by - Jay99 on 03/19/2002 10:47:48

Jay99

468 Posts

Posted - 2002-03-19 : 12:07:21
blatent bump . . .

So I have done some testing and I know that if I start the datapump while the file is still copying, I get an 'Permission Denied'.

I am looking for a sexy way to know that the file is done being copied. I don't want to 'try open...catch error', because the file is huge. I don't want to 'wait for 15 minutes', because that is 'groupie', and I am looking for something a bit more 'rock-star'.

Jay
<O>
Go to Top of Page

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2002-03-19 : 13:03:28
can the file generation process create app locks? ( as in sp_getapplock ). if so a t-sql task can sit on the lock, blocked, until the file is written.

setBasedIsTheTruepath
<O>
Go to Top of Page

Jay99

468 Posts

Posted - 2002-03-19 : 13:23:38
quote:

can the file generation process create app locks? ( as in sp_getapplock ). if so a t-sql task can sit on the lock, blocked, until the file is written.

setBasedIsTheTruepath
<O>



Unfortunately, no. The files use NDM (some secure ftp service) to arrive in a networked location from a mainframe. There is a process owned by the network team that copies the files into my directory. They aren't about to trust me to their 'processing code' and I ain't about to trust them to release the app locks correctly :)


Jay
<O>
Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2002-03-20 : 07:35:10
lateral thinking here.....if the file is still be copied out/created by NDM, is it not open to NDM?

therefore

if you try to open it using some shared binary access method (which should be fast) it'll report an reasonablely nice (and handleable) error.
or try to get it's filesize twice in a row (with appropriate reasonable delay in between) - no increase in file size => closed?? fair/workable assumption or not?)

also is there any filemgr/os method that can be called to see if the file is already open to another task? i've seen products that can report files open on a PC....can something be got and built upon the api's they use?....(mind you product seen might be utilising side effects of a proprietary database engine)


Go to Top of Page

Jay99

468 Posts

Posted - 2002-03-27 : 09:45:20
Solved here.

Jay
<O>
Go to Top of Page
   

- Advertisement -