Forum Moderators: open

Message Too Old, No Replies

Create Folder, Extra Spaces in the Path

when using dynamic parent folder name

         

Lensa

1:30 pm on Oct 29, 2009 (gmt 0)

10+ Year Member



I'm working in classic ASP and trying to create a folder, the parent folder in the path is dynamic. I'm getting 'Path not found' errors and when I included a response.write to try to debug I notice I have a space in the path that shouldn't be there, but I can't see where I'm getting the extra space in my code. The space is after the dynamic parent folder name and before the /foldername, eg: d:/Activities/GI/dynamicparentfolder /foldername

Any steer would be most welcome, I don't get this space when I remove the dynamic folder name, and similar code elsewhere in the site works fine.

Dim Fso, Folder, FolderName, Path

Path = "d:/Activities/GI/" & rs_Categories.Fields.Item("GI_Type_FolderName")
FolderName =rs_GI.Fields.Item("GI_FolderName")
Folder = Path & "/" & FolderName

Response.Write Folder

set Fso = CreateObject("Scripting.FileSystemObject")

' Create the Folder

If (NOT Fso.FolderExists(Folder)) Then

Fso.CreateFolder(Folder)

marcel

1:37 pm on Oct 29, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



try:
Path = "d:/Activities/GI/" & Trim(rs_Categories.Fields.Item("GI_Type_FolderName"))

Lensa

2:20 pm on Oct 29, 2009 (gmt 0)

10+ Year Member



Thanks for that Marcel, it works perfectly now, I can start to re-grow my hair!