Q re Dir$ 
Author Message
 Q re Dir$

Hi

I am testing for the existence of a folder using

    FolderExists = (Dir$(FolderName, vbDirectory) = ".")

I'm finding that prior to executing this command I can go into explorer
and rename the folder okay. Once this has been executed, I am informed
that it is now in-use so I can't rename it.

I wondering what I can do so that I can rename the folder. (I'm using XP
SP3)

Any suggestions? Thx.

Simon



Sat, 20 Aug 2011 00:36:29 GMT  
 Q re Dir$
Okay so I changed to

     FolderExists = (GetAttr(FolderName) = vbDirectory)

which seems to work

Thx

Quote:

> Hi

> I am testing for the existence of a folder using

>    FolderExists = (Dir$(FolderName, vbDirectory) = ".")

> I'm finding that prior to executing this command I can go into explorer
> and rename the folder okay. Once this has been executed, I am informed
> that it is now in-use so I can't rename it.

> I wondering what I can do so that I can rename the folder. (I'm using XP
> SP3)

> Any suggestions? Thx.

> Simon



Sat, 20 Aug 2011 00:45:22 GMT  
 Q re Dir$


Quote:
> Okay so I changed to

>     FolderExists = (GetAttr(FolderName) = vbDirectory)

> which seems to work

Unless other attributes are set on the folder...
CBool(GetAttr(foldername) And vbDirectory)

which can still give a false return if access is denied but is often good
enough

Quote:

>> Hi

>> I am testing for the existence of a folder using

>>    FolderExists = (Dir$(FolderName, vbDirectory) = ".")

"." is not always returned so that's never a good way to test

Quote:
>> I'm finding that prior to executing this command I can go into explorer
>> and rename the folder okay. Once this has been executed, I am informed
>> that it is now in-use so I can't rename it.

>> I wondering what I can do so that I can rename the folder. (I'm using XP
>> SP3)

>> Any suggestions? Thx.

Dir$ opens the folder so you need to close it by opening another folder;
IIRC using dir$("nul") works but it's been a while and I'm not in a position
to test it right now.


Sat, 20 Aug 2011 00:58:06 GMT  
 Q re Dir$

<snip>

Thx very much Bob

S



Sat, 20 Aug 2011 15:54:15 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Project dir Runtime VS. Project dir Designtime

2. Listing Dir's inside Dir's

3. dir$ prob returning dir from NT4 share to 95 ws

4. How can you tell if a floppy drive is empty, (cant do it with Dir, Dir$)

5. How can you tell if a floppy drive is empty, (cant do it with Dir, Dir$)

6. Dir$ function and Dir listbox gives different results

7. Project dir Runtime VS. Project dir Designtime

8. How to make DIR , delete DIR using wininet.dll

9. Find WIN DIR/MSIE tmp dir

10. How to make DIR , delete DIR using wininet.dll

11. A97 Wizard Qs

12. Newbie Qs: Optimizing Stylesheet with Fields

 

 
Powered by phpBB® Forum Software