Page 1 of 1 1
Topic Options
#199685 - 2010-08-28 02:16 AM Copy Command Fails on WIndows 7 ???
0xG Offline
Just in Town

Registered: 2010-08-28
Posts: 4
Loc: Albania
I can't believe that I am posting this, but I am desperate.
This SHOULD work, but craps out part way through...

 Code:
$DAYNUMB=@YDAYNO MOD 10
$APPDATA    = "C:\Users\mylogon\AppData\"
$TARGETapp  = "H:\Backup\Users\mylogon\" + $DAYNUMB + "\AppData\"

MD $TARGETapp
? "Copying " + $APPDATA
? "     to " + $TARGETapp
Copy          "$APPDATA" "$TARGETapp" /h /s /r /c
? "Error? " + @ERROR


The console result is
Copying C:\Users\mylogon\AppData\
to H:\Backup\Users\mylopgon\9\AppData\
Error? 0

Yet the target gets as far as creating:
H:\Backup\Users\mylogon\9\AppData
Then it ends. All folders are empty.
There should be about 900 files (!); that how many are on the source.

It seems like some kind of incompatibility with Windows 7 WTF ???
I am using latest version of KiXtart.

Thanks in advance...

Top
#199687 - 2010-08-28 02:04 PM Re: Copy Command Fails on WIndows 7 ??? [Re: 0xG]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hmmm... the first thing that comes to mind is that appdata is a one of those "fake" folders that you can't really get to...
_________________________
!

download KiXnet

Top
#199688 - 2010-08-28 02:05 PM Re: Copy Command Fails on WIndows 7 ??? [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
is mylogon actually the logonid of the loggedin user?
_________________________
!

download KiXnet

Top
#199689 - 2010-08-28 03:20 PM Re: Copy Command Fails on WIndows 7 ??? [Re: Lonkero]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
Welcome to KORG!

AppData itself isn't a redirected folder, but it does contain redirected folders, which can't be accessed. I rewrote this with the DirListUDF and it works fine because DirList enumerates the files and copies them one at a time. In my test, 5505 files were copied and 7 were skipped due to access restrictions or "file in use/locked" conditions. I test this on Windows 7 (x64) without any issue.

You'll need to download the DirList UDF from the UDF section here and change the Call statement to reference the path on your system (or eliminate the Call and embed the UDF in your script directly.

Glenn[code]$ = SetOption('WrapAtEOL', 'On')

$User = @USERID

$DAYNUMB=@YDAYNO MOD 10
$APPDATA = 'C:\Users\gbarnas\AppData\'
$TARGETapp = 'H:\Backup\Users\' + $User + '\' + $DAYNUMB + '\AppData\'

'Creating ' $TargetApp ' folder' ?
MD $TARGETapp


'Copying ' + $APPDATA ?
' to ' + $TARGETapp ?

; get array of files
$aDir = DirList($AppData, 5)
@SERROR ?
UBound($aDir) + 1 ' files to process' ?
Sleep 2
For Each $Dir in $aDir
$Dir ?
Copy $AppData + $Dir $TargetApp /h /r /c
If @ERROR
' ' @ERROR ' / ' @SERROR ?
' ##########' ?
$Err = $Err + 1
Sleep 2
EndIF
Next

$Err ' errors occurred' ?
UBound($aDir) + 1 - $Err ' files processed successfully' ?[code]
_________________________
Actually I am a Rocket Scientist! \:D

Top
#199696 - 2010-08-30 04:44 PM Re: Copy Command Fails on WIndows 7 ??? [Re: Glenn Barnas]
0xG Offline
Just in Town

Registered: 2010-08-28
Posts: 4
Loc: Albania
Thanks Lonkero, Glenn...

(Yes, "mylogon" is the current user)

Windows 7 linked folders are a real dog's breakfast.
What was MS thinking: "We are to lazy to fix our own code, so we added the links. But we don't want YOU, the user, to take advantage of them..."

So, IMO, KiXtart really is "broken" ... glad to know it wasn't just me.
(Any idea if we will see a fixed update?)

I will search around for your DirList, or build my own.
Thanks again for your help.


Edited by 0xG (2010-08-30 04:45 PM)

Top
#199697 - 2010-08-30 06:52 PM Re: Copy Command Fails on WIndows 7 ??? [Re: 0xG]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
DirList is available here in the UDF forum. It's also published on my web site in the Resources section.

Glenn

PS - Rockets don't have propellers.. \:D
_________________________
Actually I am a Rocket Scientist! \:D

Top
#199702 - 2010-08-31 12:21 PM Re: Copy Command Fails on WIndows 7 ??? [Re: Glenn Barnas]
BradV Offline
Seasoned Scripter
****

Registered: 2006-08-16
Posts: 687
Loc: Maryland, USA
They do if they are wearing a beanie! \:\)
Top
#199703 - 2010-08-31 02:31 PM Re: Copy Command Fails on WIndows 7 ??? [Re: BradV]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
I retired my beanie-copter ages ago ;\)
_________________________
Actually I am a Rocket Scientist! \:D

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 320 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.083 seconds in which 0.037 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