#35055 - 2003-01-09 09:12 PM
XCopy and Excluding Files
|
Trish
Fresh Scripter
Registered: 2002-07-09
Posts: 23
|
This is the function I need. It works great on XP.
Run Xcopy K:\dir C:\dir /EXCLUDE:\\tm2\netlogon\exclude.txt /D /v /r /k /y /i
This will copy the most current file to the new directory, and exclude and file extensions list in the text file.
My Problem: the exclude function is not available in Win 98 xcopy.
Any idea's how to copy a directory's most current files, and exclude, for example .txt Do I use ENum Function? I'm not quite sure. Thanks
|
|
Top
|
|
|
|
#35057 - 2003-01-10 01:24 PM
Re: XCopy and Excluding Files
|
Trish
Fresh Scripter
Registered: 2002-07-09
Posts: 23
|
Win98 does not have the /exclude. Is there any way kixtart can copy a directory but exclude file extensions?
Thanks
|
|
Top
|
|
|
|
#35059 - 2003-01-10 01:52 PM
Re: XCopy and Excluding Files
|
Trish
Fresh Scripter
Registered: 2002-07-09
Posts: 23
|
I'm not familiar with Robo or xxcopy. I will do some research.
I'm also looking at the Dir function in conjunction with compare file times.
But I believe another program like your suggesting may be a lot simpler.
Thanks
|
|
Top
|
|
|
|
#35063 - 2003-01-10 09:46 PM
Re: XCopy and Excluding Files
|
Trish
Fresh Scripter
Registered: 2002-07-09
Posts: 23
|
Robocopy will be great for future projects.
I tried xxcopy, and it wouldn't run correctly. It could be my syntax. I kept it the same as xcopy, and read the info, but no luck.
I tried moving the XP xcopy version to 98, copied some .dll's but it wasn't happy.
What I am doing is for 98 I copy the entire directory... ugh. And then delete what I don't want through kixtart, I'm planning to upgrade to XP to make life simpler.
|
|
Top
|
|
|
|
#35065 - 2003-01-14 09:06 PM
Re: XCopy and Excluding Files
|
Trish
Fresh Scripter
Registered: 2002-07-09
Posts: 23
|
Thanks I'll give it a try!
|
|
Top
|
|
|
|
#35066 - 2003-01-15 09:37 PM
Re: XCopy and Excluding Files
|
Trish
Fresh Scripter
Registered: 2002-07-09
Posts: 23
|
$FileName = Dir("K:\Production\Truck\*.*") While $FileName <> "" AND @ERROR = 0 If Right($filename,3) <> ".txt" ? $FileName Run xcopy K:\production\Truck\ c:\Truck\ /I /D /Y EndIf $FileName = Dir() ; retrieve next file Loop
Something's going wierd on me. FYI this is for 98 machines.
Script error: unknown or unexpected command [K:\Production\Truck]! Run Xcopy K:\Production\truck\ C:\truck\ /d
I've tried it without \ at the end, wild cards. Still the same error. This also happend when I tried to use xxcopy.
Any other thoughts?
|
|
Top
|
|
|
|
#35070 - 2003-01-16 03:18 PM
Re: XCopy and Excluding Files
|
Trish
Fresh Scripter
Registered: 2002-07-09
Posts: 23
|
The xcopy does run well as a batch file, but I could not get it to run within Kixtart.
The script using the $Source & $Target you suggested to copy via Kixtart is awesome!
I add in a md c:\truck to complete the process, and it works just as I hoped!
Thank you! Thank you! Thank you!!!
|
|
Top
|
|
|
|
#35072 - 2003-01-20 07:20 PM
Re: XCopy and Excluding Files
|
Trish
Fresh Scripter
Registered: 2002-07-09
Posts: 23
|
Copying to my 98 machines has been working like a charm, but I hoping to take it one step further by comparing files and coping only the newly changed files down to the local PC.
I have tried many variations of GetFiletime, CompareFiletimes and FreshFiles with no success. I've definity lost any logic my brain possessed. Any new thought would be greatly appreciated.
code:
MD "c:\truck" $Source="K:\Production\Truck" $Target="C:\Truck" $FileName = Dir($Source)
While $FileName <> "" AND @ERROR = 0
Function FreshFile($Source, $Target, $FileName, optional $force,) ? 'Error '+@ERROR+' - '+@SERROR Dim $compare Right($filename,3) <> "txt" AND Right $filename,3) <> "pbl" $compare=comparefiletimes("$Source\$FileName","$Target\$FileName") If $compare=1 OR $force Copy $Source+"\"+$FileName $target ? 'Error '+@ERROR+' - '+@SERROR EndIf $FileName = Dir() ; retrieve next file EndFunction ? " Updating $FileName" Loop
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 811 anonymous users online.
|
|
|