Library code snippets
Rename files using the FileSystemObject
By ElementK Journals, published on 18 Jul 2001
You may have noticed that the FileSystemObject doesn't have a Rename method
anywhere in its object model. This does not, however, mean that you can't rename
a file. The answer lies in the realization that you can use the MoveFile method,
specifying two different file names in the same directory. A sample of this
technique is shown below:<%
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
fso.MoveFile "d:\dummytest.txt",
"d:\dummytest2.txt"
%>
Related articles
Related discussion
-
Read eMails from Outlook express using ASP
by kumaravelu (1 replies)
-
Help to Call ASP function from onclick event in HTML to pass an array
by vka (0 replies)
-
Binary Studio | software development outsourcing Ukraine
by shane124 (4 replies)
-
Variable In Vb.Net
by chia (0 replies)
-
ideas in building a captive portal
by sjranjan (2 replies)
Related podcasts
-
Scott Guthrie
Scott catches up with Scott Guthrie in an interview covering Ajax, Asp 2.0, extender controls, CSS adapters and more.
Hey..
I was just wondering, with renaming a file using filessystemobject how would you go about overwriting the file if it exists. I'm sure i've read it somewhere and simply can't seem to remember it.
Any help would be great.
Thanks
<%
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
fso.CopyFile "c:dummytest.txt", "c:dummytest2.txt"
%>
This thread is for discussions of Rename files using the FileSystemObject.