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
-
Calling a function from ASP code
by dunk00 (3 replies)
-
GridView HyperLinkField Problem
by Paul2 (0 replies)
-
looking for help on asp
by cladironbeard (2 replies)
-
simple vb to c#, help please
by lksath (1 replies)
-
Binary Studio | software development outsourcing Ukraine
by Hexfinity (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.
Events coming up
-
Aug
27
Model-View-Presenter (MVC) in ASP.NET
San Francisco, United States
Model-View-Presenter (MVC) in ASP.NET Presenter Clayton Peddy, Terrace Software, Inc. Details TBD
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.