473,700 Members | 2,838 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 8142
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
5289
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
38972
by: zhisol | last post by:
how can i check if file exist in current directory (in javascript)? -- pozdr;) zhisol
2
6662
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
4732
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
5162
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
6304
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
3415
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
5718
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
1824
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
8638
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
9202
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
9058
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
8952
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,...
0
8909
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7791
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...
1
6555
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
5894
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
4649
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.