# How can I differentiate between a drive and drive plus folder?

**URL:** <https://clarionhub.com/t/how-can-i-differentiate-between-a-drive-and-drive-plus-folder/9209>\
**Category:** questions\
**Created:** [July 3, 2026, 5:07am UTC](https://clarionhub.com/t/how-can-i-differentiate-between-a-drive-and-drive-plus-folder/9209 "2026-07-03T05:07:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kenns](https://clarionhub.com/user_avatar/clarionhub.com/kenns/32/6428_2.png) [@kenns](https://clarionhub.com/u/kenns)\
**Post date:** [July 3, 2026, 5:07am UTC](https://clarionhub.com/t/how-can-i-differentiate-between-a-drive-and-drive-plus-folder/9209/1 "2026-07-03T05:07:40Z")

</div>

I am trying to create a situation where I can build a data file structure, dependent upon a selected starting point. I am using a the following code to select the starting point for my structure.  
! Get the root data location  
!------------------------------

IF FILEDIALOG(‘Select the root location for the data files.’,GLO:AppData,‘’,(FILE:LongName+FILE:Directory+FILE:KeepDir))  
DISPLAY()  
END  
My problem is that if I choose a Drive letter only, I get a following back slash ‘\’ which I accept is correct, and when I choose a folder, there is no following back slash. My code to build the structure I am seeking works just fine with a selected folder, but when it is built directly to a drive letter, I end up with a double backslash.  
My struggle is with identifying that a selected location is a drive letter, and then removing the backslash before adding my structure?

 ![image](https://clarionhub-uploads.s3.dualstack.eu-north-1.amazonaws.com/original/2X/2/250100daab954f65b94b87dad2d45468fe3693ce.png)

---

<div class="post-metadata">

**Author:** ![LANSRAD](https://clarionhub.com/user_avatar/clarionhub.com/lansrad/32/4519_2.png) [@LANSRAD](https://clarionhub.com/u/LANSRAD)\
**Post date:** [July 3, 2026, 5:55am UTC](https://clarionhub.com/t/how-can-i-differentiate-between-a-drive-and-drive-plus-folder/9209/2 "2026-07-03T05:55:35Z")

</div>

For the immediate problem, I would probably avoid making the rest of the code care whether the user selected `S:\` or `S:\SomeFolder`.

The cleaner approach is to normalize the selected root once, then always append child folders without a leading backslash.

The drive-root test itself is simple:

`LEN(CLIP(ThePath)) = 3 AND ThePath[2] = ':' AND ThePath[3] = '\'`

That identifies a path like:

`S:\`

But I would still solve the larger problem by making sure your base path ends with one backslash before you build the rest of the structure.

Conceptually:

`RootPath = CLIP(GLO:AppData)`

Then:

If `RootPath` does not already end in `\`, add one.

After that, build the child paths without starting them with `\`.

So instead of building something like:

`RootPath & '\APPDATA\COMMON'`

build it as:

`RootPath & 'APPDATA\COMMON'`

That way:

`S:\` becomes `S:\APPDATA\COMMON`

and:

`S:\SomeFolder` becomes `S:\SomeFolder\APPDATA\COMMON`

without needing special handling throughout the rest of your code.

This is also a good place where vuFileTools can help with the rest of the job.

Once the paths are built correctly, `vuCreateDirectory()` can create the full directory structure, and `vuFolderExists()` can verify that the folders exist. If you also want to validate the selected drive before creating folders, `vuDriveType()` can tell you what kind of drive you are dealing with.

So I would separate it into two steps:

1. Normalize the selected root path so it has exactly the separator behavior you expect.
2. Use vuFileTools to validate and create the resulting folder structure.

> **[All Functions](https://clarionproseries.github.io/docs/vuFileTools/functions/)**
>
> This page provides an index of every function in vuFileTools v5, grouped in a table with concise descriptions and links to full reference documentation. Use it as the master reference hub for exploring available features.
