Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Script To Copy Files From One Location To Another

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,39787
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Script To Copy Files From One Location To Another
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Script To Copy Files From One Location To Another - 11/15/2006 12:50:27 PM   
  StylinLancer


Posts: 57
Score: 0
Joined: 10/4/2006
Status: offline
Is there any kind of script I can get so I'll be able to  edit what files I want copied from one location to another?
 
 
Post #: 1
 
 RE: Script To Copy Files From One Location To Another - 11/15/2006 6:26:43 PM   
  gdewrance


Posts: 587
Score: 3
Joined: 3/16/2006
Status: offline
What are you trying to do, copy a file to a new location.
then open that file and replace text within the newly created file?

(in reply to StylinLancer)
 
 
Post #: 2
 
 RE: Script To Copy Files From One Location To Another - 11/16/2006 1:09:53 AM   
  ebgreen


Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
I thought that he wanted to select the files to be copied...now where did I leave that crystal ball?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to gdewrance)
 
 
Post #: 3
 
 RE: Script To Copy Files From One Location To Another - 11/16/2006 1:31:08 AM   
  StylinLancer


Posts: 57
Score: 0
Joined: 10/4/2006
Status: offline
I would like to copy all the *.txt in C:\Temp to lets say Z:\Temp. In a sense, I would like to create a backup of all the files in C:\Temp to Z:\Temp.

My C:\Temp is on a laptop and Z:\Temp is on my desktop.

With the script, I can go in and edit the .txt to whatever file name I want. Maybe *.doc, *.xls, etc.

Make sense now?

(in reply to StylinLancer)
 
 
Post #: 4
 
 RE: Script To Copy Files From One Location To Another - 11/16/2006 2:03:46 AM   
  ebgreen


Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
Yes. So do you want the script to just copy the *.txt files everytime it is run or do you want it to ask you for input and you tell it which files to copy every time it is run?

As an aside, there is really no need to script this. This command at a command prompt would do what you are asking for:

copy c:\temp\*.txt z:\temp

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to StylinLancer)
 
 
Post #: 5
 
 RE: Script To Copy Files From One Location To Another - 11/16/2006 2:12:11 AM   
  StylinLancer


Posts: 57
Score: 0
Joined: 10/4/2006
Status: offline
Understood about the command prompt but I want this to run behind the scenes without a dos box popping up.

I'm fairly new to vbscript, but it would be nice to ask for an input of what file types to copy.

(in reply to ebgreen)
 
 
Post #: 6
 
 RE: Script To Copy Files From One Location To Another - 11/16/2006 2:21:51 AM   
  ebgreen


Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
These two statements are contradictory:

"I want this to run behind the scenes without a dos box popping up"

"it would be nice to ask for an input of what file types to copy"

One says you do not want user interaction and the other says that you do. Either way, search the froum for these keywaords and you should find all the pieces that you need:

FileSystemObject
CopyFile
InputBox

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to StylinLancer)
 
 
Post #: 7
 
 RE: Script To Copy Files From One Location To Another - 11/16/2006 5:38:46 PM   
  gdewrance


Posts: 587
Score: 3
Joined: 3/16/2006
Status: offline
Then this should work perfectly
I went with this based on " I'm fairly new to vbscript, but it would be nice to ask for an input of what file types to copy."

      

< Message edited by gdewrance -- 11/16/2006 11:06:10 PM >

(in reply to StylinLancer)
 
 
Post #: 8
 
 RE: Script To Copy Files From One Location To Another - 11/16/2006 6:18:32 PM   
  gdewrance


Posts: 587
Score: 3
Joined: 3/16/2006
Status: offline
and then theres the quick way

Const OverwriteExisting = TRUE

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "C:\temp\*.txt" , "D:\backup\" , OverwriteExisting

(in reply to StylinLancer)
 
 
Post #: 9
 
 RE: Script To Copy Files From One Location To Another - 11/17/2006 12:48:25 AM   
  StylinLancer


Posts: 57
Score: 0
Joined: 10/4/2006
Status: offline
Thanks. I'll take a look at the suggestions given and do some searching.

(in reply to gdewrance)
 
 
Post #: 10
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Script To Copy Files From One Location To Another Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts