Mombu the Microsoft Forum

  Mombu the Microsoft Forum > Microsoft > Windows 2003 Server (TECHNET) > Exclude Files and folders while copying


User Name
Password
REGISTER NOW! Search Today's Posts Mark Forums Read


Reply
 
Thread Tools Search this Thread Display Modes
1 21st April 12:22
ramanaeb묲*h(~(
External User
 
Posts: 1
Default Exclude Files and folders while copying



hi this is ramana i got problem in WSH i need copy files and folder from
remote system to local system, the script is in WSH.
I want Exclude some files and folders remaing all should be download for
this i need this script. pls help me any body.

thank you
  Reply With Quote
SPONSORED LINKS BY GOOGLE

 


2 22nd April 21:55
External User
 
Posts: 1
Default Exclude Files and folders while copying



I think you can use something like this:

set fso = CreateObject _
("Scripting.FileSystemObject")

set folder = fso.GetFolder ("C:\Scripts\")
'exclude txt files
for each file in folder.Files
if fso.GetExtensionName (file.Path) = "txt" then
WScript.Echo file.Path & " excluded"
end if
'exclude test.txt file
if file.Name = "test.txt" then
WScript.Echo file.Path & " excluded"
end if
next

--
urkec
  Reply With Quote
3 26th April 04:14
ramanaeb묲*h(~(
External User
 
Posts: 1
Default Exclude Files and folders while copying


Thank you for early response
But iam un able to getting i use this code like this but its copying all
files but my requirment is exclude *.txt files only
pls look at this and help me pls Sir.
waiting for u reply
Thank you

************************************************** *******
Dim objNetwork,FSO,net,Wshnetwork
Dim strDriveLetter, strRemotePath, strUser, strPassword, strProfile
strDriveLetter = "Z:"
Set objNetwork = WScript.CreateObject("WScript.Network")


objnetwork.MapNetworkDrive "Z:","\\IPADRESS\c$","True","username","passwo rd"

set fso = wscript.CreateObject("Scripting.FileSystemObject")
set folder = fso.GetFolder ("Z:\xyz")

'exclude txt files
for each file in folder.Files
if fso.GetExtensionName (file.Path) = ".txt" then
WScript.Echo file.Path & " excluded"
end if
FSO.Copyfile "Z:\xyz\*.*", "c:\abc\"

'exclude test.txt file
if file.Name = "*.txt" then
WScript.Echo file.Path & " excluded"
end if
next
objnetwork.RemoveNetworkDrive "Z:"
WScript.Echo " Drive Closed:: check: "
************************************************** ********
  Reply With Quote
SPONSORED LINKS BY GOOGLE

 


4 16th August 23:26
asdf
External User
 
Posts: 1
Default Exclude Files and folders while copying


Do not do it on wsh.

If you do in in wsh,

you need two loops.

------------------------------3

One for the folders and files.
And one for the recursion.

------------------------------------

Then you must set exceptions or conditions.
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes







Copyright 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
Also visit Ogoun the Usenet Archive
666