Solved

Flushing Kill, FileCopy, etc...

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

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now