473,322 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Dir() giving odd results

PhilOfWalton
1,430 Expert 1GB
My computer name is PHIL_DESKTOP and I keep most data and programs in Drive E:

If in the immediate window I Type
Expand|Select|Wrap|Line Numbers
  1. ?dir ("\\PHIL-DESKTOP\Phil Data\", vbDirectory)
  2.  
I get . (dot) as the answer

If I type
Expand|Select|Wrap|Line Numbers
  1. ?dir ("\\PHIL-DESKTOP\Program Files (x86)\", vbDirectory)
  2.  
I get Error 52 Bad File name or number.

If I type
Expand|Select|Wrap|Line Numbers
  1. ?dir ("E:\Program Files (x86)\", vbDirectory)
  2.  
I again get . (dot) as the answer.

Any ideas what is happening here?

Thanks

Phil
Sep 22 '16 #1

✓ answered by jforbes

I'm not sure what you are attempting to do, so this may be way off base, but you could create a share to test your permissions.

This can be done on my computer, by right-clicking the Folder, clicking properties, going to the Share Tab and clicking Advanced Sharing. Then click Share this Folder, click permissions, then click on Everyone and grant them Full Control. The exact process may be different for you, but I'm sure you can figure it out.

A lot of times when messing with shares and permission, the user needs to log out and back in, to get a new Token which would refresh their permissions. Not always, but a lot of times.

Doing this may rule in or out Permissions as the culprit.

6 950
jforbes
1,107 Expert 1GB
I think you need to provide the share in the UNC Path
You might want to try the hidden C share...:
Expand|Select|Wrap|Line Numbers
  1. ?dir ("\\PHIL-DESKTOP\c$\Program Files (x86)\", vbDirectory)
  2. 'Or, in your case, e$
  3. ?dir ("\\PHIL-DESKTOP\e$\Program Files (x86)\", vbDirectory)
Sep 22 '16 #2
PhilOfWalton
1,430 Expert 1GB
Thanks, but no luck.

I suspect there is some difference between the "Program Files (x86)" folder and "Phil Data" Folder. perhaps some sort of permission attribute.

Phil
Sep 22 '16 #3
jforbes
1,107 Expert 1GB
You might try entering
Expand|Select|Wrap|Line Numbers
  1. \\PHIL-DESKTOP\Program Files (x86)\
into Windows Explorer and see if it can be resolved. I doubt it would as I'm pretty sure you still need the Computer and the Share for the UNC to work.

For me:
Expand|Select|Wrap|Line Numbers
  1. \\JFORBES\c$\Program Files (x86)
works, but the following does not:
Expand|Select|Wrap|Line Numbers
  1. \\JFORBES\Program Files (x86)
It's possible that there is a permissions thing especially with C$ as that is typically an administrative share.
Sep 22 '16 #4
PhilOfWalton
1,430 Expert 1GB
You're right.
\\PHIL-DESKTOP\Program Files (x86)\ did not resolve
or \\PHIL-DESKTOP\c$Program Files (x86)\
or \\PHIL-DESKTOP\e$\Program Files (x86)\

Have tried using filesystemoblect but no luck with that either

Thanks

Phil
Sep 22 '16 #5
jforbes
1,107 Expert 1GB
I'm not sure what you are attempting to do, so this may be way off base, but you could create a share to test your permissions.

This can be done on my computer, by right-clicking the Folder, clicking properties, going to the Share Tab and clicking Advanced Sharing. Then click Share this Folder, click permissions, then click on Everyone and grant them Full Control. The exact process may be different for you, but I'm sure you can figure it out.

A lot of times when messing with shares and permission, the user needs to log out and back in, to get a new Token which would refresh their permissions. Not always, but a lot of times.

Doing this may rule in or out Permissions as the culprit.
Sep 22 '16 #6
PhilOfWalton
1,430 Expert 1GB
Many thanks.

I use a program called ZipGenius to compress my Back End DB. There is a command line version of the program called “zg.exe”.
This is held on the server \\PHIL-DESKTOP, so the command line I need is
\\PHIL-DESKTOP\Program Files (x86)\ZipGenius 6\zg.exe –add
I need it in this format so that other computers on the network can find the program

On my Local Computer (the Server) I use a file dialog to find the program which is E:\Program Files (x86)\ZipGenius 6\Zg.exe.
I want to save it in the form
\\PHIL-DESKTOP\Program Files (x86)\ZipGenius 6\zg.exe.
(I have to manually add the –add switch)

I use the following code to convert it, with Att set to Vbnormal (As opposed to VbDirectory)
Expand|Select|Wrap|Line Numbers
  1. Function MakeFullPath(PathIn As String, Att As Byte) As String
  2.  
  3.     Dim i As Integer
  4.  
  5.     i = InStr(PathIn, ":\")       ' Something like C:\
  6.  
  7.     If i > 0 Then
  8.         PathIn = "\\" & ComputerName & "\" & Mid(PathIn, i + 2)
  9.         If Dir(PathIn, Att) = "" Then          ' Can't find PathIn
  10.             MsgBox "Something is wrong with the " & PathIn & "!", vbCritical
  11.             Exit Function
  12.         End If
  13.     End If
  14.  
Although, if I ignore the Error 52 the file gets set up correctly it would be good to confirm that the file exists.

Changing the ZipGenius 6 folder to share doesn't help.

Phil
Sep 23 '16 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Nathaniel Price | last post by:
I'm new to this list, so I'm not sure if this is the right place to post this. If not, please direct me to where it would be better to post it. Anyway, I'm creating a report generation tool of...
3
by: dibblm | last post by:
Below is current code used. I can only list one directory then move to next. I want to search one more directory further and can't seem to find how to get one deeper. What I want to accomplish is...
5
by: Jake | last post by:
Occasionally I come across: "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB" lang="en-GB" dir="ltr"> ......and so I have a...
5
by: ulyses | last post by:
Hi i have got quite strange problem. I wrote programme which shows all runnign processes. This info is get from /proc dir. When a dir that is process dir is found stat file is read and pid, name...
1
by: akinter | last post by:
Hello, and thank you for your help. I have a query that I call from a VBA function which results in a different value than when viewed in the datasheet window. The query does a calculation, and...
33
by: genc_ymeri | last post by:
Hi over there, Propably this subject is discussed over and over several times. I did google it too but I was a little bit surprised what I read on internet when it comes 'when to use what'. Most...
4
by: Sonnich | last post by:
Hi all I was wondering to try something like this: exec("dir \"".$sSearchPath."\\*.pdf\" >c:\hhh.txt"); though, it hangs at that point. I tried system(), shell_exec/() etc similar result. ...
3
by: empiresolutions | last post by:
I'm trying to build my first PHP Class. After days of tweaking, im lost. I am used to working with functions and arrays, but wrapping them in classes is confusing me. The following code is to...
4
by: KaleeyJ | last post by:
I have an Access/Jet app with a ton of VBA, and a few particular funcitons are giving me trouble. We have a part of this program where we can link a file name (with the full path) to an order....
0
by: charmeda103 | last post by:
when i run my program it runs with no erorrs but the output screen is giving me strange results here is whats its giving me: CONFERENCE OVERALL RANK TEAM W-L % WINS MARGIN W-L ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.