Solved

Flushing Kill, FileCopy, etc...

Posted on 1999-01-28
5
177 Views
Last Modified: 2010-05-03
Can anyone tell me how to refresh the directory listing that VB5's "dir" command references?  It is not refreshing quickly enough for my application, and it is returning a null string where a file has absolutely been copied.
0
Comment
Question by:NickH
5 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 1471075
Did you tried a DoEvents before your Dir command.
0
 
LVL 14

Expert Comment

by:waty
ID: 1471076
You have to re-create your dir command in order to take the new files in consideration.

sFile = Dir("*.bas")

0
 

Author Comment

by:NickH
ID: 1471077
This doesn't look like a recreation command, but more like simply issuing the command again.  This is where dir is failing...it is looking at some outdated file listing cache, and doesn't see the changes I've made with FileCopy.

emoreau:
I tried DoEvents tree times in a row on the client side, and it didn't seem to work.
0
 

Author Comment

by:NickH
ID: 1471078
Adjusted points to 60
0
 
LVL 2

Accepted Solution

by:
dm_14 earned 60 total points
ID: 1471079
Try this

(1) Check the directory you are interested in
   eg Dir ("C:\windows\*.dll")
(2) Check the root directory
   eg Dir ("C:\noexist.txt")
(3) Then recheck the directory you are interested in
   eg Dir ("C:\windows\*.dll")

The idea is that after you have finsihed checking the directory you are interested in then switch to another directory and then back to the one you are interested in and then search for files.

(If you are trying to create a file listener ie. a program that does something everytime a file appears or is modified in a directory then you should use the FindFirstChangeNotification and FindNextChangeNotification API commands)
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question