-->>Hi, here is athing I managed to write Codes that Creates a Folder for a User when Registered...
-->>The Folder takes User's registered name with some additional files inside it,works very fine...
-->>The code I used is this one:

MkDir GetAppPath() & "SPGPAC - File User Files\" & UCase(txtUserName.Text)
MkDir GetAppPath() & "SPGPAC - File User Files\" & UCase(txtUserName.Text) & "\SPGPAC - File Music"
MkDir GetAppPath() & "SPGPAC - File User Files\" & UCase(txtUserName.Text) & "\SPGPAC - File Notices"
MkDir GetAppPath() & "SPGPAC - File User Files\" & UCase(txtUserName.Text) & "\SPGPAC - File Pictures"
MkDir GetAppPath() & "SPGPAC - File User Files\" & UCase(txtUserName.Text) & "\SPGPAC - File Videos"
MsgBox "User Name: " & txtUserName.Text & " Registered Successful.", vbOKOnly + vbInformation, "Registration Completed."

-->>Now the Problem is when the User Account is Closed (Deleted) I need His/Her Parent Folder to be Deleted...
-->>But what happens is the Folder wont delete if there are some Sub Folders or Files in it...
-->>And I get "Access denied" Error the Code I used to Delete the Parent Folder is:

RmDir GetAppPath() & "\SPGPAC - File User Files\" & USER_NAME

-->>Once I delete all Sub Folders with the same line of code I get rid of It!!!
-->>So I was wondering how can I force it Out without considering Sub Folders or Files?...
-->>And an Interesting Point to Me is the Error "Access denied" if there is a Way I can Make the Folders...
-->>Inaccessible outside the Appl I hope it 'll be usefull so that Only Access is granted upon User Login...
-->>in an Application (That is Not accessible by navigating to the Location it resides and just Click to open)
-->>That's all,any help?...

try this

Dim fso As New FileSystemObject
fso.DeleteFolder GetAppPath() & "\SPGPAC - File User Files\" & USER_NAME 

before putting this code first add references and so goto project menu and then select references option and then select Microsoft Scripting Runtime

hope this helps you

commented: Nice, short and simple!! +13

-->>That realy helped Me alot and NOW I'm happy...
-->>Thanks rishif2...

-->>WOW!! Sorry almost Forgot what about:

-->>Is there a Way I can Make the FoldersInaccessible outside the Appl I hope it 'll be usefull so that Only Access is granted upon User Login...
-->>in an Application (That is Not accessible by navigating to the Location it resides and just Click to open)

I actually had the same scenario a while ago. There is no real solution to your problem because of admin right and non-admin right users. There is some software that you can use to protect a folder but that will mean that you have to run 3rd party apps to get what you want.

Don't know if anyone else here might have a solution to this. I have searched for quite some time and abondoned the entire idea. I moved over to MySql and started running my apps from a server with the databases residing there where all necessary security was in place...

-->>Thank You AndreRet,I also have decided to Move on and I was passing through the...
-->>Inno Setup Compiler Software Version 5.5.1 Inno Setup
-->>This documentation Explains some how on treating Application Files/Folder...
-->>I think it 'll lead Me some how,I'll let You know once I made it...
-->>Thanks...

Only a pleasure as usual. When done, don't forget to mark it as answered, thanx. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.