5 Replies - 104227 Views - Last Post: 14 July 2008 - 05:11 PM Rate Topic: -----

#1 jacobjordan  Icon User is offline

  • class Me : Perfection
  • member icon

Reputation: 113
  • View blog
  • Posts: 1,499
  • Joined: 11-June 08

How to copy, delete, move, and rename file in VBScript

Posted 14 July 2008 - 11:48 AM

Wish i had code to show, but can't even get started. I hope this was the right forum to post this in. I need to know how to perform basic file IO operations in VBScript (copy, delete, move, ect.). I have never used VBScript before, so any advice for a tutorial would be great too.
Is This A Good Question/Topic? 0
  • +

Replies To: How to copy, delete, move, and rename file in VBScript

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: How to copy, delete, move, and rename file in VBScript

Posted 14 July 2008 - 12:35 PM

Are you doing this in a .VBS file, or in Classic ASP? You're going to want to use the FileSystemObject for this. To copy a file in classic ASP use


Dim FSO
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
FSO.CopyFile "C:\MyTestFile.txt", "C:\TestFolder\MyTestFile.txt"
Set FSO = nothing


Was This Post Helpful? 0
  • +
  • -

#3 jacobjordan  Icon User is offline

  • class Me : Perfection
  • member icon

Reputation: 113
  • View blog
  • Posts: 1,499
  • Joined: 11-June 08

Re: How to copy, delete, move, and rename file in VBScript

Posted 14 July 2008 - 01:07 PM

I'm using a .VBS file.

This post has been edited by jacobjordan: 14 July 2008 - 01:07 PM

Was This Post Helpful? 0
  • +
  • -

#4 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: How to copy, delete, move, and rename file in VBScript

Posted 14 July 2008 - 04:13 PM

You're still going to want to use the FileSystemObject for this, that is the class that will do all of this for you (the link I offered in my original post will show all the methods available, as will this site). The modification to make from my above example is to remove the Server. in the code

Dim FSO
Set FSO = CreateObject("Scripting.FileSystemObject")
FSO.CopyFile "C:\MyTestFile.txt", "C:\TestFolder\MyTestFile.txt"
Set FSO = nothing


Was This Post Helpful? 1
  • +
  • -

#5 jacobjordan  Icon User is offline

  • class Me : Perfection
  • member icon

Reputation: 113
  • View blog
  • Posts: 1,499
  • Joined: 11-June 08

Re: How to copy, delete, move, and rename file in VBScript

Posted 14 July 2008 - 04:17 PM

Thanks, that helps. I assume it can do more than just copy files, so i will try to figure out how to do the other things i want with it.
Was This Post Helpful? 0
  • +
  • -

#6 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: How to copy, delete, move, and rename file in VBScript

Posted 14 July 2008 - 05:11 PM

@jacobjordan: If you will read those two links I provided they will show all that is possible with the FileSystemObject. It's actually quite powerful and will do all of what you're looking for
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1