Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Overwrite files

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Overwrite files
  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 >>
 Overwrite files - 6/24/2008 10:08:55 AM   
  cuzzon

 

Posts: 3
Score: 0
Joined: 6/24/2008
From: Auckland
Status: offline
Hi everyone,

Firstly, vbscript may as well be Japanese to me so I will need to be spoon feed with your replies/help.

My situation is this.
I would like to copy files within a folder on a server to a specific folder on all desktops and to automatically overwrite if the files already exist.

I have found a working example of vbscript that does the job, but there is no overwrite command. I have searched and searched and I cannot figure out how to do it.
Please can someone post an example script of what I'm trying to achieve?


Also, once I manage to get the above working I was wondering how to have the script check OS versions or folder locations?
I'll explain, most of the desktops are Vista but there are some XP machines and the path to the folder I wish to copy files into is different on each OS.

I'd like the script to try and look for the Vista location and then if it doesn't find it, to automatically find the XP location and copy the files with overwrite.

Hopefully this makes sense to everyone. It seems very complicated to me but hopefully not.

Thanks!
 
 
Post #: 1
 
 RE: Overwrite files - 6/24/2008 7:05:44 PM   
  ginolard


Posts: 1053
Score: 21
Joined: 8/10/2005
Status: offline
Well, we're not here to write scripts for you but we can point you in the right direction.

File operations are done using the FileSystemObject.  You will be wanting to use the CopyFile method.  It has an optional parameter (true/false) to specify whether the file should be overwritten or not.

To check OS Versions, you can use WMI.  That can also tell you the Windows folder location

_____________________________

Author of ManagePC - http://managepc.net
AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm
Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm

(in reply to cuzzon)
 
 
Post #: 2
 
 RE: Overwrite files - 6/25/2008 3:33:22 PM   
  cuzzon

 

Posts: 3
Score: 0
Joined: 6/24/2008
From: Auckland
Status: offline
Thanks very much, it's agood start.

(in reply to ginolard)
 
 
Post #: 3
 
 
 
  

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 >> Overwrite files 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