SS64 Discussion Forum

SS64.com

You are not logged in.

#1 2008-Jun-05 12:17:26

tinarock
Just Registered
Registered: 2008-Jun-05
Posts: 2

ROBOCOPY log file options question

We are trying to create a ROBOCOPY command that will output a log file that ends up just showing the date, filesize in bytes, and part of the destination directory path.

Thus the log file should look something like this,

20080602 66778899 2548
20080602 2233908  2548
20080602 9862234  2548

Here is the command we currently have,

robocopy e:\docs\gamnet\autofeeds\2548\ \\144.155.41.23\e$\gamnet\files\2548\2\ /r:02 /e /np >> e:\docs\gamnet\AUTOFEEDS\logs\%logfilename%

I have been tasked with figuring out which switches to put into this command so that the above logfile output happens.

I am thinking maybe I need the following switches:

/NDL
/NP
/NJS
/NJH
/BYTES

I am wondering, does /L have an effect on anything other than the log file itself?
If one puts /L switch into the ROBOCOPY command, does that cancel out the copying of the files from the source to the destination per the above command?

What's the best way to format the ROBOCOPY command so that it produces the desired log file output?

thanks in advance -

Tina Rock

Offline

 

#2 2008-Jun-05 12:35:25

bluesxman
Sun Fire
From: Leeds, UK
Registered: 2006-Dec-29
Posts: 578

Re: ROBOCOPY log file options question

/L will cause robocopy to show you what it would have done with the other options you supplied, without actually doing it.  So in a roundabout way, that's a "Yes" on that question.

As for your main question, it's not going to be possible to achieve your requirements with "robocopy" alone, I'm afraid it's just not that flexible.

You're going to have to throw on a few more switches (/BYTES /R:02 /E /NP /TS /NDL /NJS /NJH /NC should do it), then do some work with the log file to pull the size, date and path apart, such that it all displays as you require.

Suffice it to say, this won't be a one-liner! smile

Last edited by bluesxman (2008-Jun-05 13:02:03)

Offline

 

#3 2008-Jun-05 16:06:26

tinarock
Just Registered
Registered: 2008-Jun-05
Posts: 2

Re: ROBOCOPY log file options question

Hi Bluesman,
thanks for the suggestions.
We tried modifying the command so that it was:

robocopy e:\docs\gamnet\autofeeds\2548\ \\144.155.41.23\e$\gamnet\files\2548\2\ /r:02 /e /np /BYTES /NDL /NJS /NJH /NC >> e:\docs\gamnet\AUTOFEEDS\logs\%logfilename%

however, the logfile produced merely said

ERROR : Invalid Parameter #6 : "/BYTES"

which I thought was kind of weird, since /BYTES is a listed switch for Robocopy.
Does the order of the switches matter?

Also the log file output didn't show the things I need, such as the bytesize for each copied file.

Do you have any suggestions or ideas?

thanks,
Tina Rock

Offline

 

#4 2008-Jun-06 04:46:21

bluesxman
Sun Fire
From: Leeds, UK
Registered: 2006-Dec-29
Posts: 578

Re: ROBOCOPY log file options question

The order of the switches doesn't matter, except that they're best placed at the end of the command line, as you have already done.  You probably have version XP010 of robocopy then; it's not noted in the article, but I believe the /BYTES switch only works with version XP026 and, presumably, version XP027.

I only know of one way to get XP026 ... you must install the Microsoft Robocopy GUI (which isn't anywhere near as exciting as it might sound, by the way.)  This will drop a copy of XP026 in your %windir%\system32 directory, which you can then copy/move around as you wish.

I should point out that a major draw back with XP026 is that, despite its extra functionality, it has a bug whereby it never returns an errorlevel other than 0, so it's very hard to catch errors.

If that's not acceptable, and you wish to pursue options with XP010, you'd have to drop the "/BYTES" switch in favour of the "/NS" switch (yes, I really do mean you should suppress size reporting -- due to some idiosyncrasies with this it makes life easier if we drop it altogether).  Then, when post-processing the log, we'd have to do some jiggery pokery to get the file size from the OS; since we're going to have to do some work with the log file anyway, this shouldn't be too onerous.

Actually, side thought, if the target location isn't going to be empty, we need to add the "/XX" switch, lest we get some files in the log that we didn't mean to.

Once you're happy that robocopy is producing the log properly, I'll help you address the hacking apart thereof.

Last edited by bluesxman (2008-Jun-06 07:13:36)

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2008