Solved

Flushing Kill, FileCopy, etc...

Posted on 1999-01-28
5
180 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 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
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 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…

707 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