ful56_uk Posted July 24, 2009 Posted July 24, 2009 hi guys can any help me out with a script, I have 2 one that copys a folder to the local c and one that deletes it what i want is one script that will first check if the folder is there, if it is delete it and the copy a new one from a network share. if the folder is not there then copy the folder form the network share. can any one help? thanks mark
Chillibear Posted July 24, 2009 Posted July 24, 2009 Any particular language/OS? If you wanted to do it with a batch file, you can check to see if a directory exists (c:\temp in this example) with something like following: IF NOT EXIST C:\TEMP\NUL GOTO NODIR REM - stuff to do if dir exists exit :NODIR REM - stuff to do if dir does not exist exit However if I understand what you want the sequence is: check for dir if it exists delete it copy dir from LAN So in any case you copy the new folder down, so just add a command to delete it first (rmdir /s /q should do it), if it's not there then you'll probably get an error back, but I doubt it'd break things. Apologies if I've misunderstood. 1
dhicks Posted July 24, 2009 Posted July 24, 2009 what i want is one script that will first check if the folder is there, if it is delete it and the copy a new one from a network share. if the folder is not there then copy the folder form the network share. In a particular language? Here's a simple batch file: @echo off if exist c:\myFolder erase /S /Q c:\myFolder copy n:\myFolder c:\ -- David Hicks 1
ful56_uk Posted July 25, 2009 Author Posted July 25, 2009 Vb really I have a vb script to delete the folder. Problem is because I don't know enough. When the folder isn't there is it gives me a error on screen. What I really want is for it to contiune without error. @ chillibear. That is the sequnce. Check if folder is there, if it is delete it, if not move on to copying folder from network share to c.
sted Posted July 25, 2009 Posted July 25, 2009 Vb really I have a vb script to delete the folder. Problem is because I don't know enough. When the folder isn't there is it gives me a error on screen. What I really want is for it to contiune without error. @ chillibear. That is the sequnce. Check if folder is there, if it is delete it, if not move on to copying folder from network share to c. add on error resume next to the code somewhere near the top 1
mac_shinobi Posted July 25, 2009 Posted July 25, 2009 example 2 Tutorial VBScript. Example FSO creates folder with CreateFolder 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now