We need you!

We're working hard on the next version of Developer Fusion. Let us know what you think we should be up to!

Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

Rated
Read 95,205 times

Related Categories

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"
%>

© 2001 Element K Journals, a division of Element K Press LLC ("Element K"). Element K and the Element K logo are trademarks of Element K LLC

Comments

  • Re: Copy Files using the FilesystemObject

    Posted by tonz1984 on 18 Apr 2007

    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 r...

  • Copy Files using the FilesystemObject

    Posted by KKat on 27 Nov 2002

    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 a...