Page 1 of 1

Determine if exist in unknown folder

Posted: Sun Jun 28, 2015 7:46 am
by Rhez
Hello again boogy;

Got some problem and I dunno how to do it.

I want to check if a file from unknown folder exist idoit;
for example: I want to check a save_settings.dll in a user created folder "User"

Account/User/save_settings.dll

Account is the root folder
User will be the folder (unknown folder cause this may change depend on user input)
save_settings.dll the file to be check if exist.

location may vary depends on user input:
other example

Account/MyDog/save_settings.dll
Account/CoolApps/save_settings.dll

I hope you gets my problem blusho;

Re: Determine if exist in unknown folder

Posted: Sun Jun 28, 2015 11:25 am
by comathi
Code: Select all
If My.Computer.FileSystem.FileExists("Account\" + user_created_folder + "\save_settings.dll") Then
    MessageBox.Show("The file exists!")
Else
    MessageBox.show("The file does not exist!")
End If
user_created_folder is a String that represents the user created.

Re: Determine if exist in unknown folder

Posted: Sun Jun 28, 2015 12:01 pm
by Rhez
No. My Project is separated to its main application.
To make it easy to understand. The one project will create user profile. The other project will check for file existence

Re: Determine if exist in unknown folder

Posted: Sun Jun 28, 2015 2:21 pm
by comathi
Right... so this should work

Re: Determine if exist in unknown folder

Posted: Tue Jun 30, 2015 7:08 pm
by mandai
You could use this code to list the user folders and check for the file:
Code: Select all
        Dim users As String() = IO.Directory.GetDirectories("Account")

        For Each user In users

            Dim path As String = user & "\save_settings.dll"
            If IO.File.Exists(path) Then
                MsgBox("found " & path)

            End If

        Next

Re: Determine if exist in unknown folder

Posted: Wed Jul 08, 2015 1:34 pm
by Rhez
Hello mandai. Gonna try yours. Seems like this one is what I'm looking for boogy;