Library code snippets
Rename files using the FileSystemObject
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
-
Header and Footer in Web page print
by fhajaj (4 replies)
-
help me to get simple requirement
by Slicksim (1 replies)
-
Gridview -> Template Field -> Button
by antti.simonen (1 replies)
-
Classic ASP : Page expires
by chezhian_in05 (0 replies)
-
ASP VS PHP
by paulfp (9 replies)
Related podcasts
-
ASP.NET Caching and Performance
Steve Smith, owner of ASP Alliance and Lake Quincy Media joins us today to teach us about some hidden gems in ASP.NET caching and performance. Steve’s expertise in this area comes from first-hand experience as Lake Quincy’s ad system serves over 60 requests per second and handles over 150 million...
Related jobs
-
Microsoft .Net Architect
in AMSTERDAM (€50K-€90K per annum) -
Microsoft Dynamics CRM Technical Consultant
in Netherlands (€50K-€90K per annum) -
Technical Support Engineer EMEA
in Reading (£50K-£50K per annum) -
Solutions Engineer
in Reading (£50K-£60K per annum)
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
I am very new to this world but was looking for a method copy files. I have then noticed this code under the subject Rename a file using the Filesystemobject. I though that it may work with Copyfile aswell and guess what it does work very well. So for those who may want to know here is the code to copy a file using the FilesystemObject.
<%
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.