Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Script needed to check for file, rename and copy another .

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Script needed to check for file, rename and copy 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 needed to check for file, rename and copy another . - 3/22/2006 8:49:15 AM   
  Woodzter

 

Posts: 57
Score: 0
Joined: 10/25/2005
Status: offline
I am useless at scripts but need someone to help me out. I need a script to run in a GPO on computer start up.
I need it to check for a file in systems 32,   ie, c:\windows\system32\file.dll.
If it exists i need the script to rename the file to oldfile.dll.
Then the script needs to copy a new file.dll to the same location from a folder on the server.

Could anyone please help me.
 
 
Post #: 1
 
 RE: Script needed to check for file, rename and copy an... - 3/22/2006 9:08:10 AM   
  ziminski

 

Posts: 79
Score: 2
Joined: 1/8/2006
Status: offline
search the forums there are plenty. starting with this:
http://www.visualbasicscript.com/m_31725/mpage_1/key_check%2cfile/tm.htm#32011

(in reply to Woodzter)
 
 
Post #: 2
 
 RE: Script needed to check for file, rename and copy an... - 3/22/2006 9:14:34 AM   
  Cybex


Posts: 412
Score: 0
Joined: 9/14/2005
From: Florida
Status: offline
If you did that wouldn't it always find it, rename it, and copy one from the server?  It would become a loop that on every logon it would do it.  Perhaps you should check the file version instead and apply your logic against that.

Just a thought...


Cybex

_____________________________

Common sense is not so common.

(in reply to Woodzter)
 
 
Post #: 3
 
 RE: Script needed to check for file, rename and copy an... - 3/22/2006 9:33:03 AM   
  Woodzter

 

Posts: 57
Score: 0
Joined: 10/25/2005
Status: offline
@cybex


This is a great idea but i have no knowledge of scripting and this is well out of my depth i am afraid.

I have used this forum a few times and have had to rely on its members good will to  help me out.

(in reply to Cybex)
 
 
Post #: 4
 
 RE: Script needed to check for file, rename and copy an... - 3/22/2006 12:19:34 PM   
  Cybex


Posts: 412
Score: 0
Joined: 9/14/2005
From: Florida
Status: offline
I don't know Good or Will, they must be new. 

This should work as a logon script, just change the tFile and sFile paths.  I made the replace action a function so you could call it mutiple times in case you have more than one file you need to keep up to date this way.


      


Cybex

_____________________________

Common sense is not so common.

(in reply to Woodzter)
 
 
Post #: 5
 
 RE: Script needed to check for file, rename and copy an... - 3/22/2006 7:37:27 PM   
  Woodzter

 

Posts: 57
Score: 0
Joined: 10/25/2005
Status: offline
I have only just noticed that hte dll file does not have a version assigned to it, i tried t remove that line but the script throws an error.


Sorry to be a pain but is it possible to have a script that just renames the old file or even overwrites it?

(in reply to Cybex)
 
 
Post #: 6
 
 RE: Script needed to check for file, rename and copy an... - 3/23/2006 7:47:48 AM   
  ebgreen


Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
Here is Cybex's code without the version check:


      

_____________________________

"... 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 Woodzter)
 
 
Post #: 7
 
 RE: Script needed to check for file, rename and copy an... - 3/27/2006 11:13:38 PM   
  Woodzter

 

Posts: 57
Score: 0
Joined: 10/25/2005
Status: offline
Thanks for that,

Is there a way i can adapt the script todo this?

I need it to check if a file path exists ie: c:\windows\system32\foldera (there will be files in foldera but this is not important its the fiel path that is)

if it does not i need it to run a .exe file form the server IE: \\servername\path\software.exe.

(in reply to ebgreen)
 
 
Post #: 8
 
 RE: Script needed to check for file, rename and copy an... - 3/28/2006 2:08:58 AM   
  ebgreen


Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
If oFSO.FolderExists("c:\windows\system32\foldera") Then
   'Run whateever you want here
End If

_____________________________

"... 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 Woodzter)
 
 
Post #: 9
 
 
 
  

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 needed to check for file, rename and copy 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