#46514 - 2003-10-09 08:33 PM
Move with subdirs
|
j0ep
Fresh Scripter
Registered: 2003-09-26
Posts: 14
|
Hi,
I need to move a directory and subdirectories. Is there any way to do this besides start a shell with xcopy /s and a shell with del /s ? [ 09. October 2003, 20:34: Message edited by: j0ep ]
|
|
Top
|
|
|
|
#46516 - 2003-10-09 08:39 PM
Re: Move with subdirs
|
j0ep
Fresh Scripter
Registered: 2003-09-26
Posts: 14
|
I am familiar with the move command, but it cannot move a complete directory with subdirectories
Here's the code :
code:
$listvartest = "c:\test\*.*" $dirlisttest = dirlist($listvartest,1) For Each $sFilem In $dirlisttest $x = SubStr($sfilem, Len($sfilem), 1) If $x = "\" $rc=isinarray ($allowedsubdirs,$sFilem) If $rc = 0 MD "c:\backup\test\" + $sfilem Shell "%comspec% /c move /Y " + Chr(34) + "c:\test\" + $sFilem + "*.*" + Chr(34) + " " + Chr(34) + "c:\backup\test\" + $sfilem + Chr(34) RD "c:\test\" + $sfilem EndIf EndIf Next
But it doesn't work for subdirs with a subdir (get it ?) [ 09. October 2003, 20:48: Message edited by: j0ep ]
|
|
Top
|
|
|
|
#46519 - 2003-10-09 08:55 PM
Re: Move with subdirs
|
j0ep
Fresh Scripter
Registered: 2003-09-26
Posts: 14
|
Okee thanx for that (my kix editor was still pointing to the kix 4.21).
So, I try:
code:
MOVE $testpath + "\main\" + $sFilem + "*.*" $backpath + "\main\" + $sfilem /s
edit: this works, but doesn't delete the subdirs... any1 ? [ 09. October 2003, 20:59: Message edited by: j0ep ]
|
|
Top
|
|
|
|
#46521 - 2003-10-09 10:21 PM
Re: Move with subdirs
|
j0ep
Fresh Scripter
Registered: 2003-09-26
Posts: 14
|
glad to know that's working for you, but over here, the subdirs remain. Checked for read-omly, but that isn't the problem
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 665 anonymous users online.
|
|
|