Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


File Does Not Exists

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> File Does Not Exists
  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 >>
 File Does Not Exists - 11/18/2008 5:12:34 AM   
  nik1420

 

Posts: 61
Score: 0
Joined: 12/19/2007
Status: offline
I'm trying to write this script that will copy down a file from the server, if it does not exists locally. I can't get my thoughts together, so I need some help.
Here's what I have:

FILE1="c:\program files\app\file.txt"

Set objFSO = CreateObject ("Scripting.FileSystemObject")

If objFSO.FileExists(FILE1) Then
  Wscript.sleep 1000
Else
  objFSO.CopyFile \\Server\Apps\Program\file.txt, "C:\Program Files\app\"
End If


This works, but is there another way to write this, simplified way so that I don't have the Wscript.sleep?? If the file exists, I don't want it to do anything.

Thanks in advance...
 
 
Post #: 1
 
 RE: File Does Not Exists - 11/18/2008 5:25:28 AM   
  dm_4ever


Posts: 2728
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
If Not objFSO.FileExists(FILE1) Then
  objFSO.CopyFile \\Server\Apps\Program\file.txt, "C:\Program Files\app\"
End If

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to nik1420)
 
 
Post #: 2
 
 RE: File Does Not Exists - 11/18/2008 6:20:10 AM   
  nik1420

 

Posts: 61
Score: 0
Joined: 12/19/2007
Status: offline
dm - thanks for my brain fart!!


(in reply to dm_4ever)
 
 
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 >> File Does Not Exists 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