Retrieving Folder Name... - Forum

Forum Navigation
You need to log in to create posts and topics.

Retrieving Folder Name...

Hello All,

I used FolderBox command in VisualNeoWin for selecting a folder and loaded that one in [savedFolder] variable. This variable holds the complete path of the folder selected. E.g D:\democontent\vnw\.

Now I need the folder name only(vnw) and no path as I want to create a sub-folder under the [savedFolder] variable with the folder name vnw. Once I fired the command

CreateFolder "[savedfolder]\[savedFolder]  it is complaining as the variable is having value "D:\democontent\vnw\.D:\democontent\vnw\."

Please suggest me how to retrieve the current folder name only without path value

 

@sghoshnbu

This variable holds the complete path of the folder selected. E.g D:\democontent\vnw\.

When I invoke FolderBox, I do NOT get the final \ ... e.g. c:\gk\Neo5\gkLab

Now I need the folder name only(vnw) and no path as I want to create a sub-folder under the [savedFolder] variable with the folder name vnw. Once I fired the command

CreateFolder "[savedfolder]\[savedFolder] it is complaining as the variable is having value "D:\democontent\vnw\.D:\democontent\vnw\."Please suggest me how to retrieve the current folder name only without path value

Try this code ...

FolderBox "Select Folder" "[savedFolder]"

ExtractFilePath "[savedFolder]" "[Path]"
StrReplace "[savedFolder]" "[Path]" "" "[withoutPath]" ""
SetVar "[newFolder]" "[savedFolder]\[withoutPath]"
AlertBox "Your selection" "[savedFolder] ... [Path] ... [withoutPath][#13][#10][newFolder]"

.CreateFolder "[newFolder]"

... once you are satisfied with the value of [newFolder], uncomment the last command.

proforma.guyot has reacted to this post.
proforma.guyot