Page 1 of 2 12>
Topic Options
#35055 - 2003-01-09 09:12 PM XCopy and Excluding Files
Trish Offline
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
#35056 - 2003-01-10 10:59 AM Re: XCopy and Excluding Files
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Trish,

as far as I know the 98' xcopy has significant differences in command line switches (Maybe it also hasn't got this functionality) ... You may want to check the help for it on a 98 machine (which I haven't got at the moment to doublecheck )

hth

J.
_________________________



Top
#35057 - 2003-01-10 01:24 PM Re: XCopy and Excluding Files
Trish Offline
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
#35058 - 2003-01-10 01:28 PM Re: XCopy and Excluding Files
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
hmm ... actually I think of using RoboCopy in that case , or xxcopy for that matter ... What about these ?
_________________________



Top
#35059 - 2003-01-10 01:52 PM Re: XCopy and Excluding Files
Trish Offline
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
#35060 - 2003-01-10 02:19 PM Re: XCopy and Excluding Files
Andy Cippico Offline
Fresh Scripter

Registered: 2003-01-09
Posts: 17
Loc: UK
FYI: Robocopy only works under NT/W2K.
Top
#35061 - 2003-01-10 02:42 PM Re: XCopy and Excluding Files
Rocco Capra Offline
Hey THIS is FUN
*****

Registered: 2002-04-01
Posts: 380
Loc: Mansfield Ohio
I have an idea!

I had a problem with FTP.exe on an NT box. It seemed that it did not work the same as the FTP.exe on a WIN2K box. (FTP.exe=CMD line version)

Solution = Copied the FTP.exe from the 2K box over top of the FTP.exe on the NT box.

Now I don't know if there are any dependant files that xcopy needs, you will have to reasearch that, but FTP.exe had no dependant files so we were able to get away with it.

HTH,
Rocco
_________________________
I Love this board!! -------------------- My DEV PC is running KIX 4.22 WINXP Pro

Top
#35062 - 2003-01-10 03:17 PM Re: XCopy and Excluding Files
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
Robocopy from the NT3.51 service pack works with Win9x. (All higher version will not work with Win9x) I suggest using this or xxcopy but you might check out the UDF forum for Kixtart solutions.
_________________________
Jack

Top
#35063 - 2003-01-10 09:46 PM Re: XCopy and Excluding Files
Trish Offline
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
#35064 - 2003-01-10 10:02 PM Re: XCopy and Excluding Files
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
Trish...
Maybe something like this will do the trick...
This will exclude *.txt extensions...
code:
$FileName = Dir("C:\TEMP")  ; <-- put your directory here
While $FileName <> "" and @ERROR = 0
If Right($filename,3) <> "txt"
? $FileName
; put your xcopy command here
EndIf
$FileName = Dir() ; retrieve next file
Loop



[ 10. January 2003, 22:03: Message edited by: Waltz ]
_________________________
We all live in a Yellow Subroutine...

Top
#35065 - 2003-01-14 09:06 PM Re: XCopy and Excluding Files
Trish Offline
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 Offline
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
#35067 - 2003-01-15 09:40 PM Re: XCopy and Excluding Files
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Try the command from the command line before advancing to the KiXtart script itself. And please post code in between [CODE] tags!
_________________________
There are two types of vessels, submarines and targets.

Top
#35068 - 2003-01-15 10:18 PM Re: XCopy and Excluding Files
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
missing quotes and you should probably use SHELL instead of RUN. See the FAQs.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#35069 - 2003-01-15 10:19 PM Re: XCopy and Excluding Files
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
Trish...
This example should copy all files excluding those with a txt extension...
code:
$Source="K:\Production\Truck"
$Target="C:\Truck"
$Exclude="txt"
;
$FileName = Dir($Source)
While $FileName <> "" and @ERROR = 0
If Right($Filename,3) <> $Exclude
Copy $Source+"\"+$Filename $Target
EndIf
$FileName = Dir()
Loop



[ 15. January 2003, 22:26: Message edited by: Waltz ]
_________________________
We all live in a Yellow Subroutine...

Top
#35070 - 2003-01-16 03:18 PM Re: XCopy and Excluding Files
Trish Offline
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
#35071 - 2003-01-16 03:22 PM Re: XCopy and Excluding Files
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
[Cool]
You're welcome! You're welcome! You're welcome!
_________________________
We all live in a Yellow Subroutine...

Top
#35072 - 2003-01-20 07:20 PM Re: XCopy and Excluding Files
Trish Offline
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
#35073 - 2003-01-20 08:16 PM Re: XCopy and Excluding Files
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Suggestion: Check the UDF library, e.g. UpdateFile().
_________________________
There are two types of vessels, submarines and targets.

Top
#35074 - 2003-01-20 08:42 PM Re: XCopy and Excluding Files
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
Trish...
Keep on Truckin'...
code:
$Source = "K:\Production\Truck"
$Target = "C:\Truck"
If Exist($Target) = 0
MD $Target
Endif
$FileName = Dir($Source)

While $FileName <> "" AND @ERROR = 0
If Right($Filename,3) <> "txt" OR Right($Filename,3) <> "pbl"
$compare = CompareFileTimes($Source+"\"+$FileName,$Target+"\"+$FileName)
If $compare = 1 OR $compare = -3
Copy $Source+"\"+$FileName $Target
EndIf
Endif
$FileName = Dir()
Loop



[ 20. January 2003, 22:23: Message edited by: Waltz ]
_________________________
We all live in a Yellow Subroutine...

Top
Page 1 of 2 12>


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 811 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.075 seconds in which 0.026 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org