473,770 Members | 1,901 Online
Bytes | Software Development & Data Engineering Community
+ 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.FolderExist s(strCurrentPat h) Then
oFO.CreateFolde r(strCurrentPat h) '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 1707
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.FolderExist s(strCurrentPat h) Then
On Error Resume Next
oFO.CreateFolde r(strCurrentPat h)
If Not oFO.FolderExist s(strCurrentPat h) Then
strErrNum = Err.number
strErrMessage = Err.Description
End If
On Error GoTo 0
If Len(strErrMessa ge) > 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.tx t" 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.goo glegroups.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.tx t" 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.goo glegroups.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(TR IM("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(TR IM("c:\test \test2 "))

Ooops!
I trimmed the first CreateFolder so now when creating the second I have
to trim both...
CreateFolder(TR IM("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******** *************@t 31g2000cwb.goog legroups.com...
When beginning development, you are correct. Just use Trim or something
similar.

*Code written w/o vars for ease.
So I:
CreateFolder(TR IM("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(TR IM("c:\test \test2 "))

Ooops!
I trimmed the first CreateFolder so now when creating the second I have
to trim both...
CreateFolder(TR IM("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.goo glegroups.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

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

Similar topics

1
1730
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
6444
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 permission. Does anyone know if I can get this page to login as a different user in order to run this script ?
4
1809
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 workgroup instead. I've enabled the write option in IIS on the directory. Because I'm not in a domain, there's no security tab on the property dialog for the folder in Windows Explorer, so I can't assign IUSR access right there. Do you have any...
0
1618
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 chances here. Thanks... I am trying to get the code below to work with no success, I googled the issue but docs popped up provided little help. Basically I am trying to create a directory in RS that uses Forms authentication. Everything works on the...
13
6616
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
5024
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. I created the websetup and built the MSI, have the bundled version. Copied to webserver and ran Websetup.msi. Said I had to remove old version, which I did, then reran WebSetup.msi and keeps giving me this error. "The installer was interrupted...
1
2235
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 path as per the example. But we get this error "could not find a part of the path". we are prefixing the path with @ symbol and also tried with the escaping the "\\".
3
2298
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
2670
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 codes, error, etc. and cannot find what it returns. The syntax document for the method on MSDN doesn't list what it returns. I need to know what the method can return so I can handle exceptions.
0
9618
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10259
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10101
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10038
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7456
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5354
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2849
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.