?
Solved

Flushing Kill, FileCopy, etc...

Posted on 1999-01-28
5
Medium Priority
?
181 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 180 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…
Suggested Courses

743 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