|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Finding files and/or foldersHi
Is there any easy way to find a file on a given drive? , like API calls... Or at least; how can I determine where windows stores it's shared files?? i.e. C:\Program Files\Common Files\Microsoft Shared..... (in US versions) Kjell Kjell try this
it is easy way to find file it's not an api on a form put a textbox and commandbutton Option Explicit Private Sub Command1_Click() If Text1.Text = "" Then MsgBox "What are you looking for?" Text1.SetFocus Exit Sub End If If Dir(Text1.Text) > "" Then MsgBox "File and/or directory exists" Else MsgBox "File does not Exist! Make sure you have entered" _ & vbNewLine & " the proper filename, extension and/or directory." Text1.SetFocus End If End Sub Private Sub Form_Load() Command1.Caption = "Find" 'use C:\Program Files\Common Files\Microsoft Shared instead of "C:\" Text1.Text = "C:\" Text1.SelStart = Len(Text1.Text) End Sub Show quoteHide quote "Kjell" <Kj***@discussions.microsoft.com> wrote in message news:D73004EF-75F1-419C-9F6E-47C9DD0F288F@microsoft.com... > Hi > > Is there any easy way to find a file on a given drive? , like API calls... > > Or at least; how can I determine where windows stores it's shared files?? > i.e. C:\Program Files\Common Files\Microsoft Shared..... (in US versions) > > > Kjell Thanks George maybe I was unclear with my goal...
I have no idea where to start looking for the file...... I know that once I'm there I can use Dir() to verify the file. My problem is How to find the folder..... 2:nd problem I've been using the API 'SHGetFolderPath' a couple of times and it works fine for many things, I now need to locate the folder for 'shared files', but I cannot find the CSIDL for that. Is there another way to determine the folder for shared files?? Kjell
http://vbnet.mvps.org/code/fileapi/recursivefiles_minimal.htm
Show quote Hide quote "Kjell" <Kj***@discussions.microsoft.com> wrote in message
news:F50B4DED-88E0-46EF-BE18-6AF61A596C93@microsoft.com... > Thanks George maybe I was unclear with my goal... > > I have no idea where to start looking for the file...... I know that once > I'm there I can use Dir() to verify the file. > > My problem is How to find the folder..... > > 2:nd problem I've been using the API 'SHGetFolderPath' a couple of times > and it works fine for many things, I now need to locate the folder for > 'shared files', but I cannot find the CSIDL for that. > > Is there another way to determine the folder for shared files?? > > > Kjell :-) That's what I'm looking for, thanks Norm and of course: A big thanks to Randy BirchBtw, I think I've found the way to get correct path to "shared files" folder. check out the reg key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools Key: SharedFilesDir I've checked both win2000 and WinXP (US and Swedish) it seems to be the one I need. :-) Kjell Show quoteHide quote "Norm Cook" wrote: > http://vbnet.mvps.org/code/fileapi/recursivefiles_minimal.htm > > "Kjell" <Kj***@discussions.microsoft.com> wrote in message > news:F50B4DED-88E0-46EF-BE18-6AF61A596C93@microsoft.com... > > Thanks George maybe I was unclear with my goal... > > > > I have no idea where to start looking for the file...... I know that once > > I'm there I can use Dir() to verify the file. > > > > My problem is How to find the folder..... > > > > 2:nd problem I've been using the API 'SHGetFolderPath' a couple of times > > and it works fine for many things, I now need to locate the folder for > > 'shared files', but I cannot find the CSIDL for that. > > > > Is there another way to determine the folder for shared files?? > > > > > > Kjell > > > There is no specific folder for shared files, any folder can be shared and
any shared folder can have one of various permissions depending upon who is accessing the folder. If fact in NT derived operating systems (2k, XP 2003 etc) all folders are shared with what's called an "Default share", this is to allow the administrator to make backups without having to get explicit permission for each folder. To find a file anywhere on a volume the best solution is a recursive routine using the FindFirst, FindNext and FindClose API calls, The link Norm Cook gave you will cover that. Best regards Dave O. Show quoteHide quote "Kjell" <Kj***@discussions.microsoft.com> wrote in message news:F50B4DED-88E0-46EF-BE18-6AF61A596C93@microsoft.com... > Thanks George maybe I was unclear with my goal... > > I have no idea where to start looking for the file...... I know that once > I'm there I can use Dir() to verify the file. > > My problem is How to find the folder..... > > 2:nd problem I've been using the API 'SHGetFolderPath' a couple of times > and it works fine for many things, I now need to locate the folder for > 'shared files', but I cannot find the CSIDL for that. > > Is there another way to determine the folder for shared files?? > > > Kjell I'm not talking about sharing folders/files, I know how that works.
I'm looking for the default place on the client machine where installed program places files that can be shared with other program on the same machine. for example, On a normal WinXP pro for US it would be: C:\Program Files\Common Files\Microsoft Shared (at least I think this is the place) On my own Win2000 Pro (Swedish) the same place is: C:\Program\Delade filer\Microsoft Shared My question is: how will an installation routine find this place on different Win versions and languages. ? Kjell Show quoteHide quote "Dave" wrote: > There is no specific folder for shared files, any folder can be shared and > any shared folder can have one of various permissions depending upon who is > accessing the folder. If fact in NT derived operating systems (2k, XP 2003 > etc) all folders are shared with what's called an "Default share", this is > to allow the administrator to make backups without having to get explicit > permission for each folder. > > To find a file anywhere on a volume the best solution is a recursive routine > using the FindFirst, FindNext and FindClose API calls, The link Norm Cook > gave you will cover that. > > Best regards > Dave O. > > "Kjell" <Kj***@discussions.microsoft.com> wrote in message > news:F50B4DED-88E0-46EF-BE18-6AF61A596C93@microsoft.com... > > Thanks George maybe I was unclear with my goal... > > > > I have no idea where to start looking for the file...... I know that once > > I'm there I can use Dir() to verify the file. > > > > My problem is How to find the folder..... > > > > 2:nd problem I've been using the API 'SHGetFolderPath' a couple of times > > and it works fine for many things, I now need to locate the folder for > > 'shared files', but I cannot find the CSIDL for that. > > > > Is there another way to determine the folder for shared files?? > > > > > > Kjell > > > |
|||||||||||||||||||||||