Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

any xcopy experts?

Thread Tools
 
Search this Thread
 
Old 29 June 2009, 12:55 PM
  #1  
ChristianR
Scooby Regular
Thread Starter
iTrader: (1)
 
ChristianR's Avatar
 
Join Date: May 2001
Location: Europe
Posts: 6,329
Likes: 0
Received 1 Like on 1 Post
Default any xcopy experts?

Code:
@echo off
pause

for /F "tokens=*" %%* in ('dir /ad /b *') do call :Sub %%*
goto :eof

:sub
echo Current folder: %*
mkdir D:\backup\%*

xcopy "D:\path\%*\"*.* "D:\backup\%*\"*.* /e /v /c /i /h /y /k >>D:\backup\copytest.txt 2>> D:\backup\error.log

:eof
The script gets a list of the directory in the folder it is ran, and copies it to another location.
I'm trying to log errors into a separate file. Which is working but will only display the error and not the path it was trying. Which isn't very helpful

Access denied
File not found - *.*

Anyway to do log the path it was trying in the error log?
Thanks
Old 29 June 2009, 01:35 PM
  #2  
HankScorpio
Scooby Regular
 
HankScorpio's Avatar
 
Join Date: Feb 2004
Posts: 5,848
Likes: 0
Received 0 Likes on 0 Posts
Default

Give up, use robocopy. Life's too short.
Old 29 June 2009, 01:38 PM
  #3  
ChristianR
Scooby Regular
Thread Starter
iTrader: (1)
 
ChristianR's Avatar
 
Join Date: May 2001
Location: Europe
Posts: 6,329
Likes: 0
Received 1 Like on 1 Post
Default

i guess I could use robocopy.. surely must be a way in xcopy to do what im after?
Old 29 June 2009, 01:50 PM
  #4  
KiwiGTI
Scooby Regular
 
KiwiGTI's Avatar
 
Join Date: Aug 2004
Posts: 4,631
Likes: 0
Received 0 Likes on 0 Posts
Default

Give up and use a VB Script in WSH.
Old 29 June 2009, 03:11 PM
  #5  
ChristianR
Scooby Regular
Thread Starter
iTrader: (1)
 
ChristianR's Avatar
 
Join Date: May 2001
Location: Europe
Posts: 6,329
Likes: 0
Received 1 Like on 1 Post
Default

Originally Posted by HankScorpio
Give up, use robocopy. Life's too short.
whats the option to just log errors ?
Old 29 June 2009, 03:16 PM
  #6  
HankScorpio
Scooby Regular
 
HankScorpio's Avatar
 
Join Date: Feb 2004
Posts: 5,848
Likes: 0
Received 0 Likes on 0 Posts
Default

Not sure there is one but errors are easy to pick out of the log, just use a find at the end of the job.
Old 29 June 2009, 04:08 PM
  #7  
hodgy0_2
Scooby Regular
 
hodgy0_2's Avatar
 
Join Date: Jul 2008
Location: K
Posts: 15,633
Received 21 Likes on 18 Posts
Default

get hold of a copy of securecopy

Secure Copy server and data consolidation with seamless integration and migration with copying files, shares, groups and directories - AMT Software

awsome bit of kit
Old 29 June 2009, 05:46 PM
  #8  
Hanley
Scooby Regular
 
Hanley's Avatar
 
Join Date: May 2002
Location: Liverpool
Posts: 3,229
Likes: 0
Received 0 Likes on 0 Posts
Default

At the end of your xcopy line use the following

>> c:\logfile.txt 2>&1
Old 01 July 2009, 12:26 PM
  #9  
J4CKO
Scooby Regular
iTrader: (1)
 
J4CKO's Avatar
 
Join Date: Jan 2003
Posts: 19,384
Likes: 0
Received 1 Like on 1 Post
Default

Robocopy or Perl.
Old 01 July 2009, 12:32 PM
  #10  
ChristianR
Scooby Regular
Thread Starter
iTrader: (1)
 
ChristianR's Avatar
 
Join Date: May 2001
Location: Europe
Posts: 6,329
Likes: 0
Received 1 Like on 1 Post
Default

I modified the original script for robocopy in the end and just scanned the log file

cheers for suggestions
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
roysc
ScoobyNet General
2
16 September 2015 09:10 AM
The Joshua Tree
Computer & Technology Related
18
11 September 2015 09:24 PM
PeterJ
ScoobyNet General
1
24 July 2001 05:26 PM



Quick Reply: any xcopy experts?



All times are GMT +1. The time now is 11:30 AM.