#37851 - 2003-03-12 06:58 PM
Multiple file type copy
|
LoInScr
Lurker
Registered: 2003-03-12
Posts: 4
|
New to Kix & scripting, but am faced with a problem that I cannot get xcopy to provide.
User has common file types ie. doc, xls, etc... These files need to be copied from desktop to network share for migration to new desktop.
I've looked through most of the common areas FAQ but cannot find the information.
How to provide a list of files to be copied, copy these types to network share?
|
|
Top
|
|
|
|
#37854 - 2003-03-12 08:25 PM
Re: Multiple file type copy
|
LoInScr
Lurker
Registered: 2003-03-12
Posts: 4
|
Finally found DirList() UDF. Parsing array and using Copy to perform ops.
Thanks Jen et all.
|
|
Top
|
|
|
|
#37855 - 2003-03-14 03:21 PM
Re: Multiple file type copy
|
LoInScr
Lurker
Registered: 2003-03-12
Posts: 4
|
Having a problem using the Copy & Shell commands while trying to do the multiple file copy operation.
The DirList() UDF returns everything fine [I am searching all subdirs in the root drive for specific file types] to a message box, but when traversing the array returned from DirList to copy these files [using Copy() or passing Xcopy via Shell()] I get the script hung and will not return until my netowrk connection times out & removes my offline file access to the server that I am copying to.
Any thoughts or suggestions would be welcome.
|
|
Top
|
|
|
|
#37857 - 2003-03-14 03:29 PM
Re: Multiple file type copy
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
dos batch file: code:
for /r c:\ %%a in (*.doc) do xcopy "%%a" h:\Word /s /i for /r c:\ %%a in (*.xls) do xcopy "%%a" h:\Excel /s /i for /r c:\ %%a in (*.ppt) do xcopy "%%a" h:\PowerPoint /s /i for /r c:\ %%a in (*.pub) do xcopy "%%a" h:\Publisher /s /i for /r c:\ %%a in (*.mdb) do xcopy "%%a" h:\Access /s /i for /r c:\ %%a in (*.pst *.pab) do xcopy "%%a" h:\Outlook /s /i
|
|
Top
|
|
|
|
#37859 - 2003-03-14 04:42 PM
Re: Multiple file type copy
|
LoInScr
Lurker
Registered: 2003-03-12
Posts: 4
|
Will research using the suggestion for the batch file, but I still want to find out why the operation times out. It will copy 7-8 files of 68 total.
The code lines follow:
(note - UDF DirList is inline to script, not added to post for clarity. CurrentFolder & CurrentWorkingFolder are just string concats for each user's specific folders on the file server)
code:
$FileList = DIRLIST("c:\*.rtf",2+4) For Each $Filename In $FileList ;Append double quotes to string for proper cmd line parsing $strFileName = Chr(34) + $Filename + Chr(34) $strCurrentFolder = Chr(34) + $CurrentWorkingFolder + Chr(34) ;MessageBox($strCurrentFolder, "Current Working Folder") ;MessageBox($strFileName, "File") ;Construct proper string representation of command line to pass onto ;Xcopy via Kix Shell. $strShellCMD = "CMD.EXE /C XCOPY " + $strFileName + " " + $strCurrentFolder + "/z /q /y"
Shell $strShellCMD
$strFileName = "" $strCurrentFolder = ""
Next
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 2220 anonymous users online.
|
|
|