473,398 Members | 2,335 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

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.createobject("scripting.filesystemobject")
set fs = fso.GetFile("c:\boot.ini")
fs.name = "c:\boot.old"
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 8134
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*******@databyggarna.com> wrote in message
news:51**************************@posting.google.c om...
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.createobject("scripting.filesystemobject")
set fs = fso.GetFile("c:\boot.ini")
fs.name = "c:\boot.old"
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_machinename?

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:eR**************@TK2MSFTNGP09.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*******@databyggarna.com> wrote in message
news:51**************************@posting.google.c om...
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.createobject("scripting.filesystemobject")
set fs = fso.GetFile("c:\boot.ini")
fs.name = "c:\boot.old"
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*****@hotmail.com> wrote in message
news:Om**************@TK2MSFTNGP12.phx.gbl...
I don't think that's a problem.

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

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:eR**************@TK2MSFTNGP09.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*******@databyggarna.com> wrote in message
news:51**************************@posting.google.c om...
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.createobject("scripting.filesystemobject")
set fs = fso.GetFile("c:\boot.ini")
fs.name = "c:\boot.old"
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.createobject("scripting.filesystemobject")
set fs = fso.GetFile("c:\blabla.txt")
fs.name = "blabla.old"
set fs = nothing
set fso = nothing
%>
<%
Set fso = Server.CreateObject("Scripting.FileSystemObject")
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****************@TK2MSFTNGP12.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*****@hotmail.com> wrote in message
news:Om**************@TK2MSFTNGP12.phx.gbl...
I don't think that's a problem.

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

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:eR**************@TK2MSFTNGP09.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*******@databyggarna.com> wrote in message
news:51**************************@posting.google.c om...
> 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.createobject("scripting.filesystemobject")
> set fs = fso.GetFile("c:\boot.ini")
> fs.name = "c:\boot.old"
> 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*******@databyggarna.com> wrote in message
news:51**************************@posting.google.c om...
Hi
You copy some code, and add some files, and then testing....
I've never tried this part of Scripting.FileSystemObject 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_machinename anything what so ever in root....
After giving IUSR_machinename 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*****@hotmail.com> wrote in message

news:<es**************@TK2MSFTNGP12.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
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...
12
by: zhisol | last post by:
how can i check if file exist in current directory (in javascript)? -- pozdr;) zhisol
2
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...
2
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....
1
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
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> ...
22
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...
11
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...
0
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
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...
0
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
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...

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.