Page 1 of 1 1
Topic Options
#37851 - 2003-03-12 06:58 PM Multiple file type copy
LoInScr Offline
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. [Confused]

How to provide a list of files to be copied, copy these types to network share?

Top
#37852 - 2003-03-12 07:42 PM Re: Multiple file type copy
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Look at any of the DIR...() UDFs, like DirList() or DirPlus().
_________________________
There are two types of vessels, submarines and targets.

Top
#37853 - 2003-03-12 08:04 PM Re: Multiple file type copy
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
We've been down this road before...
Maybe this link will get you started... XCopy and ....
_________________________
We all live in a Yellow Subroutine...

Top
#37854 - 2003-03-12 08:25 PM Re: Multiple file type copy
LoInScr Offline
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 Offline
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
#37856 - 2003-03-14 03:27 PM Re: Multiple file type copy
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Without seeing your actual code it's hard to give suggestions.
_________________________
There are two types of vessels, submarines and targets.

Top
#37857 - 2003-03-14 03:29 PM Re: Multiple file type copy
Radimus Moderator Offline
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

_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#37858 - 2003-03-14 03:34 PM Re: Multiple file type copy
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
basically the thing (if not recursion needed) is to use dirlist ( or dirplus or dirscan) as:
code:
for each $file in dirlist($folder,2)
copy $file $destination_folder
next

_________________________
!

download KiXnet

Top
#37859 - 2003-03-14 04:42 PM Re: Multiple file type copy
LoInScr Offline
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
Page 1 of 1 1


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

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.087 seconds in which 0.067 seconds were spent on a total of 12 queries. Zlib compression enabled.

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