473,473 Members | 1,816 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Error in CreateFolder()?

Hi.

When I use CreateFolder() to create a folder with a space at the end,
it creates the folder successfully, but still errors out with a "Path
not Found" error.

For example:
<%
Dim strCurrentPath

strCurrentPath = "c:\test folder \

If Not oFO.FolderExists(strCurrentPath) Then
oFO.CreateFolder(strCurrentPath) 'Errors on this line.
End If
%>

After the folder is created, it cannot be deleted or renamed
immediately. I think there still must be some process attached. The
error when trying to delete it is: "Cannot delete file: Cannot read
from the source file or disk."

I need to be able to leave the space in for now.

Any ideas on why this occurs?

Thanks!

Apr 14 '06 #1
10 1684
Just as a follow on, I can get around this by adding "on error" around
the createFolder(), but I'd rather get to the bottom of the error.

Here is an example of something I would do:

<%
Dim strCurrentPath
Dim strErrNum, strErrMessage

strCurrentPath = "c:\test folder \

If Not oFO.FolderExists(strCurrentPath) Then
On Error Resume Next
oFO.CreateFolder(strCurrentPath)
If Not oFO.FolderExists(strCurrentPath) Then
strErrNum = Err.number
strErrMessage = Err.Description
End If
On Error GoTo 0
If Len(strErrMessage) > 0 Then
Err.Raise strErrNum, "CreateFolder(), strErrMessage
End If
End If
%>

Apr 14 '06 #2
After some investigation, it appears that if you leave off the trailing
"\" on the path, the folder gets created successfully with no error,
and the trailing space gets stripped off.

Unfortunately, with FileExists() if you are looking for "c:\test
\folder\test.txt" it won't strip and it won't match.

On a brigher note (slightly) this is taken care of in asp.net with all
trailing spaces removed on exists() and createfolder() with or without
the final "\".

Apr 14 '06 #3
I cant see why you would want to create a folder with a space at the end?

"anjelone" <an******@gmail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
After some investigation, it appears that if you leave off the trailing
"\" on the path, the folder gets created successfully with no error,
and the trailing space gets stripped off.

Unfortunately, with FileExists() if you are looking for "c:\test
\folder\test.txt" it won't strip and it won't match.

On a brigher note (slightly) this is taken care of in asp.net with all
trailing spaces removed on exists() and createfolder() with or without
the final "\".

Apr 15 '06 #4
We use user input project names to create folders and then reference
those project names to read from those folders. This is a legacy aspect
of the system that will definitely change, but it is so integrated at
this point that it needs to stay for the time being.

I'm hoping it will be converted to a better system in the next 2
months, but the show must go on until then.

Anyway, it is interesting to see the inconsistencies and I can't be the
first to be bitten by it...

Apr 17 '06 #5
I still don't understand

Why cant you just use Trim(folderName) to get rid of the space?

"anjelone" <an******@gmail.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
We use user input project names to create folders and then reference
those project names to read from those folders. This is a legacy aspect
of the system that will definitely change, but it is so integrated at
this point that it needs to stay for the time being.

I'm hoping it will be converted to a better system in the next 2
months, but the show must go on until then.

Anyway, it is interesting to see the inconsistencies and I can't be the
first to be bitten by it...

Apr 17 '06 #6
When beginning development, you are correct. Just use Trim or something
similar.

*Code written w/o vars for ease.
So I:
CreateFolder(TRIM("c:\test "))
Then I want to put another folder in that first one from a different
section of the site at a different time:
CreateFolder(TRIM("c:\test \test2 "))

Ooops!
I trimmed the first CreateFolder so now when creating the second I have
to trim both...
CreateFolder(TRIM("c:\test ") + TRIM("\test2 "))

And what happens when I use FileExists or FolderExists? Same
thing....Trim's on everything.

In my case I would have to add that in approximately 200 files of code,
multiple times in some of them.
For a set of code used in 16 seperate production sites, that is a lot
of changing and a whole lot of testing.
Not to mention that file uploading, downloading and manipulation are
integral to our product so if something went wrong with that it would
be a major issue.

Again, "I'm hoping it will be converted to a better system in the next
2 months, but the show must go on until then."

Plus, I'm not condoning this "trailing space" practice in any way, mind
you, it is simply the code I'm dealing with. You must understand the
position of walking into old badly developed code and having to deal
until you can correct it...

Apr 19 '06 #7

"anjelone" <an******@gmail.com> wrote in message
news:11*********************@t31g2000cwb.googlegro ups.com...
When beginning development, you are correct. Just use Trim or something
similar.

*Code written w/o vars for ease.
So I:
CreateFolder(TRIM("c:\test "))
Then I want to put another folder in that first one from a different
section of the site at a different time:
CreateFolder(TRIM("c:\test \test2 "))

Ooops!
I trimmed the first CreateFolder so now when creating the second I have
to trim both...
CreateFolder(TRIM("c:\test ") + TRIM("\test2 "))

And what happens when I use FileExists or FolderExists? Same
thing....Trim's on everything.

In my case I would have to add that in approximately 200 files of code,
multiple times in some of them.
For a set of code used in 16 seperate production sites, that is a lot
of changing and a whole lot of testing.
where are the stored?
lop though them

using the 1 line of code including trim?

Not to mention that file uploading, downloading and manipulation are
integral to our product so if something went wrong with that it would
be a major issue.

Again, "I'm hoping it will be converted to a better system in the next
2 months, but the show must go on until then."

Plus, I'm not condoning this "trailing space" practice in any way, mind
you, it is simply the code I'm dealing with. You must understand the
position of walking into old badly developed code and having to deal
until you can correct it...

Apr 19 '06 #8
Folder names are project names, task names, contract names, review
names, location names and report names that users input. All files
associated with all those things go into the folder named for that
thing.

Apr 19 '06 #9

"anjelone" <an******@gmail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
Folder names are project names, task names, contract names, review
names, location names and report names that users input. All files
associated with all those things go into the folder named for that
thing.


I'm mean in a programming sense, you must have them in a database or a array
or something,

there for you only have to use Trim once and loop though your collection
Apr 20 '06 #10
The users still have the ability in a bunch of places to hand enter the
names so that it all gets messed up again.
And we pull from other datasources where there also have been trailing
spaces.
Its quite a mess really.

Apr 21 '06 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Suresh | last post by:
CreateFolder method does not produce a result from IIS. I tried many things including changing file permissions, web server permissions etc. to no avail. Can you please help?
3
by: AndrewM | last post by:
Hello everyone, I have an asp page with a create folder script fs.CreateFolder(path) When running this on the server I get a Permission denied message as the IUSER account has no write...
4
by: Bren | last post by:
In the code below I'm trying to create a directory. It works on the production server, but it doesn't on my dev server; I'm running XP Pro, but I don't belong to a domain; I'm running it in a...
0
by: Skeptical | last post by:
Greetings, This question is related to Microsoft Reporting Services Web service. I tried asking it in RS groups but no one seems to be knowledgeable enough to answer, so I wanted to try my...
13
by: deko | last post by:
I use this convention frequently: Exit_Here: Exit Sub HandleErr: Select Case Err.Number Case 3163 Resume Next Case 3376 Resume Next
7
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying....
1
by: Steve | last post by:
Hi all, I am referring to this article in MSDN : http://msdn.microsoft.com/library/en-us/secauthn/security/logonuser.asp While creating folder on the remote machine, we are specifying the UNC...
3
by: Ali Chambers | last post by:
Hi, I have created a listbox called "dtlist1" on my VB.NET form. I call a procedure as follows: Private Sub openfile(flname As String) dtlist1.Items.Clear() etc..
1
by: RdS | last post by:
Hello, I have been searching for what createfolder can return or does return. Where on MSDN can I find what a MS method returns? I have searched for filesystemobject.createfolder errors, error...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.