Login | |
|
 |
RE: How to exclude certain file types from a CopyFolder... - 6/2/2008 4:34:04 AM
|
|
 |
|
| |
ebgreen
Posts: 5041
Score: 31
Joined: 7/12/2005
Status: offline
|
Look at a tool called RoboCopy. Otherwise you will have to write code to do the checking yourself. Not hard code to write, but Robocopy already has it all so why reinvent the wheel?
_____________________________
"... 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
|
|
| |
|
|
|
 |
RE: How to exclude certain file types from a CopyFolder... - 6/3/2008 1:48:37 AM
|
|
 |
|
| |
ebgreen
Posts: 5041
Score: 31
Joined: 7/12/2005
Status: offline
|
I may need to add a section on this to the frequently asked stuff thread. Here is the best way that I have found to work out the qotes for a .Run command. Follow this procedure exactly. 1) Open a command prompt 2) In the command prompt, work out exactly how the command needs to look to function from a command line. Once you get it, copy it to the clipboard. 3) Open your favorite VBS editor and create a completely new script file 4) In the editor on the first line put a ' then paste in the command line text that you copied in step 2. This is your goal. 5) Type this into the editor (if you want you can name the shell object whatever it is called in your main script to make things easier later): Dim oWsh:Set oWsh = CreateObject("WScript.Shell") Dim strCMD strCMD = "" WScript.Echo strCMD 6) Now change the value of strCMD to be whatever you think would make it be the same as what you copied in ste 2. 7) Run the script 8) Compare the output of the script to the comment that you made on line 1 of the script. 9) Repeat steps 6-8 changing strCMD a little bit at a time until the output of the script is exactly the same as what worked at the command prompt 10) Copy the line that is setting the value of strCMD 11) Paste that into your main script just before where you want to do the .Run command. 12) Change the .Run command in the main script so that it tries to .Run strCMD
_____________________________
"... 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
|
|
| |
|
|
|
 |
RE: How to exclude certain file types from a CopyFolder... - 6/3/2008 3:32:14 AM
|
|
 |
|
| |
ebgreen
Posts: 5041
Score: 31
Joined: 7/12/2005
Status: offline
|
To be honest with you in my opinion if you are trying to do that much exclusion, I would do the whole thing with a RoboCopy JOB file instead of trying to do it at the command line.
_____________________________
"... 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
|
|
| |
|
|
|
 |
RE: How to exclude certain file types from a CopyFolder... - 6/3/2008 3:36:32 AM
|
|
 |
|
| |
dm_4ever
Posts: 2665
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
|
This is how I start out Copy original to a text editor cmd /c Robocopy "C:\Documents and Settings\user\Desktop" "\\Server\Backup Share\User\Desktop" /S /XF *.mp3 *.gho *.img *.jpg Do a search/replace single " with double " with the editor cmd /c Robocopy ""C:\Documents and Settings\user\Desktop"" ""\\Server\Backup Share\User\Desktop"" /S /XF *.mp3 *.gho *.img *.jpg Add a " before and after "cmd /c Robocopy ""C:\Documents and Settings\user\Desktop"" ""\\Server\Backup Share\User\Desktop"" /S /XF *.mp3 *.gho *.img *.jpg" WScript.Echo this new string to make sure it maches the original WScript.Echo "cmd /c Robocopy ""C:\Documents and Settings\user\Desktop"" ""\\Server\Backup Share\User\Desktop"" /S /XF *.mp3 *.gho *.img *.jpg" Locate the string I want to replace with a variable WScript.Echo "cmd /c Robocopy ""C:\Documents and Settings\user\Desktop"" ""\\Server\Backup Share\User\Desktop"" /S /XF *.mp3 *.gho *.img *.jpg" Replace this string value immediately with " & & " WScript.Echo "cmd /c Robocopy ""C:\Documents and Settings\" & & "\Desktop"" ""\\Server\Backup Share\User\Desktop"" /S /XF *.mp3 *.gho *.img *.jpg" Insert the variable name in between the & & WScript.Echo "cmd /c Robocopy ""C:\Documents and Settings\" & strVariableGoesHere & "\Desktop"" ""\\Server\Backup Share\User\Desktop"" /S /XF *.mp3 *.gho *.img *.jpg" Repeat as needed
_____________________________
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
|
|
| |
|
|
|
|
|