473,597 Members | 2,364 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

change a file name from asp (rather vbscript)

As there is no change filename command in vbscript you have to take a
diversion.
According to aspfaq http://www.aspfaq.com/show.asp?id=2074
the following should work:
<%
set fso = server.createob ject("scripting .filesystemobje ct")
set fs = fso.GetFile("c: \boot.ini")
fs.name = "c:\boot.ol d"
set fs = nothing
set fso = nothing
%>
a) never rename boot.ini b) in "real life" you have to get the
relative path to the file.
I do exactly the above swapping boot.ini for blabla.txt (and
blabla.old)
This returns a script error (0x800A0005) 'Invalid procedure call or
argument'
asfaq has in http://www.aspfaq.com/show.asp?id=2101 some suggestions
that I think does not apply to this situation
Win XP Pro and IIS 5 (not surprising) both patched as much as possible
At the moment it's not necessary to solve the problem but it will be
later on
Mats
Jul 19 '05 #1
5 8139
You're trying to name the FILE with a \ and : in it. The name of the file
would not be C:\boot.old; it would just be boot.old.

Ray at work

"Mats" <we*******@data byggarna.com> wrote in message
news:51******** *************** ***@posting.goo gle.com...
As there is no change filename command in vbscript you have to take a
diversion.
According to aspfaq http://www.aspfaq.com/show.asp?id=2074
the following should work:
<%
set fso = server.createob ject("scripting .filesystemobje ct")
set fs = fso.GetFile("c: \boot.ini")
fs.name = "c:\boot.ol d"
set fs = nothing
set fso = nothing
%>
a) never rename boot.ini b) in "real life" you have to get the
relative path to the file.
I do exactly the above swapping boot.ini for blabla.txt (and
blabla.old)
This returns a script error (0x800A0005) 'Invalid procedure call or
argument'
asfaq has in http://www.aspfaq.com/show.asp?id=2101 some suggestions
that I think does not apply to this situation
Win XP Pro and IIS 5 (not surprising) both patched as much as possible
At the moment it's not necessary to solve the problem but it will be
later on
Mats

Jul 19 '05 #2
I don't think that's a problem.

Did you give permission for blabla.txt to be manipulated by
IUSR_machinenam e?

"Ray at <%=sLocation% >" <myfirstname at lane34 dot com> wrote in message
news:eR******** ******@TK2MSFTN GP09.phx.gbl...
You're trying to name the FILE with a \ and : in it. The name of the file
would not be C:\boot.old; it would just be boot.old.

Ray at work

"Mats" <we*******@data byggarna.com> wrote in message
news:51******** *************** ***@posting.goo gle.com...
As there is no change filename command in vbscript you have to take a
diversion.
According to aspfaq http://www.aspfaq.com/show.asp?id=2074
the following should work:
<%
set fso = server.createob ject("scripting .filesystemobje ct")
set fs = fso.GetFile("c: \boot.ini")
fs.name = "c:\boot.ol d"
set fs = nothing
set fso = nothing
%>
a) never rename boot.ini b) in "real life" you have to get the
relative path to the file.
I do exactly the above swapping boot.ini for blabla.txt (and
blabla.old)
This returns a script error (0x800A0005) 'Invalid procedure call or
argument'
asfaq has in http://www.aspfaq.com/show.asp?id=2101 some suggestions
that I think does not apply to this situation
Win XP Pro and IIS 5 (not surprising) both patched as much as possible
At the moment it's not necessary to solve the problem but it will be
later on
Mats


Jul 19 '05 #3
I'll bet you a dollar. :P

Actually, I think that after he corrects the filename line, he will then run
into the permissions problem you suggest. For the love of God, I would hope
that IUSR doesn't have rights to boot.ini.

Ray at work

"Tom B" <sh*****@hotmai l.com> wrote in message
news:Om******** ******@TK2MSFTN GP12.phx.gbl...
I don't think that's a problem.

Did you give permission for blabla.txt to be manipulated by
IUSR_machinenam e?

"Ray at <%=sLocation% >" <myfirstname at lane34 dot com> wrote in message
news:eR******** ******@TK2MSFTN GP09.phx.gbl...
You're trying to name the FILE with a \ and : in it. The name of the file would not be C:\boot.old; it would just be boot.old.

Ray at work

"Mats" <we*******@data byggarna.com> wrote in message
news:51******** *************** ***@posting.goo gle.com...
As there is no change filename command in vbscript you have to take a
diversion.
According to aspfaq http://www.aspfaq.com/show.asp?id=2074
the following should work:
<%
set fso = server.createob ject("scripting .filesystemobje ct")
set fs = fso.GetFile("c: \boot.ini")
fs.name = "c:\boot.ol d"
set fs = nothing
set fso = nothing
%>
a) never

Jul 19 '05 #4
Do you take paypal?
I tried the following, I gave permission for the iusr_mymachine for full
control of my c: drive.
Obviously I commented out one section to test the other.
The first code wouldn't work with c:\blabla.old (as Ray said) but the second
code did.

Perhaps Aaron should update
http://www.aspfaq.com/show.asp?id=2074
to reflect that

<%@ Language = "VBScript" %>
<html>
<body>
<%
set fso = server.createob ject("scripting .filesystemobje ct")
set fs = fso.GetFile("c: \blabla.txt")
fs.name = "blabla.old "
set fs = nothing
set fso = nothing
%>
<%
Set fso = Server.CreateOb ject("Scripting .FileSystemObje ct")
fso.moveFile "c:\blabla.txt" , "c:\blabla. old"
Set fso = Nothing
%>

</body>
</html>
<%

%>
"Ray at <%=sLocation% >" <myfirstname at lane34 dot com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
I'll bet you a dollar. :P

Actually, I think that after he corrects the filename line, he will then run into the permissions problem you suggest. For the love of God, I would hope that IUSR doesn't have rights to boot.ini.

Ray at work

"Tom B" <sh*****@hotmai l.com> wrote in message
news:Om******** ******@TK2MSFTN GP12.phx.gbl...
I don't think that's a problem.

Did you give permission for blabla.txt to be manipulated by
IUSR_machinenam e?

"Ray at <%=sLocation% >" <myfirstname at lane34 dot com> wrote in message
news:eR******** ******@TK2MSFTN GP09.phx.gbl...
You're trying to name the FILE with a \ and : in it. The name of the file would not be C:\boot.old; it would just be boot.old.

Ray at work

"Mats" <we*******@data byggarna.com> wrote in message
news:51******** *************** ***@posting.goo gle.com...
> As there is no change filename command in vbscript you have to take a > diversion.
> According to aspfaq http://www.aspfaq.com/show.asp?id=2074
> the following should work:
> <%
> set fso = server.createob ject("scripting .filesystemobje ct")
> set fs = fso.GetFile("c: \boot.ini")
> fs.name = "c:\boot.ol d"
> set fs = nothing
> set fso = nothing
> %>
> a) never


Jul 19 '05 #5
The fso is what has the deletefile method, not the file (fs).

Ray at home

--
Will trade ASP help for SQL Server help
"Mats" <we*******@data byggarna.com> wrote in message
news:51******** *************** ***@posting.goo gle.com...
Hi
You copy some code, and add some files, and then testing....
I've never tried this part of Scripting.FileS ystemObject before.
You think a page like aspfaq would know, but even the sun has spots
they say :-)
I might not be fully aware of all aspects of vbscript, but so stupid
that I allow IUSR_machinenam e anything what so ever in root....
After giving IUSR_machinenam e permissions in the appropriate folder it
worked just fine using only the filename in the "naming part".
However fs.DeleteFile creates an error (0x800A01B6)
Object doesn't support this property or method.
It really doesn't matter, but out of curiosity I'd like to know why.
Mats
"Tom B" <sh*****@hotmai l.com> wrote in message

news:<es******* *******@TK2MSFT NGP12.phx.gbl>. ..
Do you take paypal?
I tried the following, I gave permission for the iusr_mymachine for full
control of my c: drive.
Obviously I commented out one section to test the other.
The first code wouldn't work with c:\blabla.old (as Ray said) but the second code did.

Perhaps Aaron should update
http://www.aspfaq.com/show.asp?id=2074
to reflect that

Jul 19 '05 #6

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

Similar topics

18
5271
by: Sean | last post by:
Hi, I need a pop-up window for user to confirm change. The default button is the second option (No). As the user only use IE, I think the VBScript is an option. The following code only works for html button. I wonder how I can change it to VB code behind file and use a server control. Thanks. <script language="VBScript">
12
38952
by: zhisol | last post by:
how can i check if file exist in current directory (in javascript)? -- pozdr;) zhisol
2
6646
by: Fabrizio | last post by:
I have just put a internet webcam that save every 30 seconds a picture via ftp. I have an html file that display this picture file (the name of the file is always the same and the webcam delete the old file when save the new one). The problem is: The webcam don't have the option to put automatically the date and time when the picture as take. How I can make a simple JavaScript that get the creation date and time of the file sent by the...
2
4727
by: Ruskin | last post by:
I have developed an upload tool, that allows users to upload files (funny that). The asp form object has a 'SizeLimit' property that can be set, to prevent files being uploaded, that are too large. Is there a way in Javascript, to interrogate the file size before the form is posted, so that the validation can be done before trying to post the form. The only information I can find, on file size, relates to images. But any file can be...
1
5158
by: Frank | last post by:
Short Version of Question: Can anyone provide an example of how I should embed the ActiveX and license, and then use it in a function?
4
6285
by: andreas.w.h.k. :-\) | last post by:
How do I change the address location in the wsdl <wsdl:port name="SearchSoap12" binding="tns:SearchSoap12"> <soap12:address location="http://searchservices/engine/search.asmx" /> </wsdl:port> Anderas
22
3402
by: Bob and Sharon Hiller | last post by:
I have an ASP page that was done in VBScript It is setup to read an Access database and I need to change it to read a Sql 2005 Database. The code that is used to open the Access Database: Set adoConnection = server.CreateObject("ADODB.Connection") Set adoRecordset = server.CreateObject("ADODB.Recordset") adoConnection.Provider = "Microsoft.Jet.OLEDB.4.0" Dim strLocation, iLength
11
5691
by: strychtur | last post by:
Hi all, I have a vbscript that renames msg files to Sender - Subject. What I am looking to do is change the modified date of the msg file to be the received date of the email. The thing is I could swear the following code was doing this last week. Upon double checking this week the name was changing but not the modified date. Any help would be great as this is my first vbscript. On Error Resume Next Dim olkApp, olkMessage, objFSO,...
0
1822
by: ismailc | last post by:
Good day, I need help. I have an application that uses aspx pages together with vbscript window for developer coding. Now the page has an <input type='file'> upload object. The problem is that on the same page submit button i'm uploading the file AND executing vbscript command that renames & emails the file that is been loaded. It keeps on crashing as when it looks for the file to rename the file has not uploaded yet.
0
7962
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
7884
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8267
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
8380
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...
0
6681
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5423
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3880
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...
1
1493
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1229
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.