# Formatting Robocopy Output?? Is it possible



## scrfix (May 3, 2009)

I am curious.

When I was using xcopy, I could output to a file and it was formatting nice and neat. Very easy to read. I have attached an example of what I am about to ask.

When using Robocopy, the text starts out in the middle of the screen and a redirect to a .doc file outputs the same thing.

This makes it extremely difficult to read on long folder within folder within folder within folder files.

Is there any way possible to format what the output of robocopy so it starts out at the left end and outputs to the doc file like that as well?

Just curious. I did look in Google under Formatting Robocopy however could not return any decent results. Is it supposed to look like that? Vieww the image. See all the whitespace. Does yours do that? Why?


----------



## Squashman (Apr 4, 2003)

_Posted via Mobile Device_
How are you outputting to the document? Are you using any of the logging options in robocopy?


----------



## scrfix (May 3, 2009)

Yes. I am utilizing the /LOG+:"f:\log.doc".


----------



## Squashman (Apr 4, 2003)

Not sure what you are looking for but my log file looks pretty nicely formatted.


----------



## scrfix (May 3, 2009)

In your log file,

Do you see this line?
16 C:\Program Files\Adobe\Reader 8.0\Resource\Font\

See how far over it is.
I would like it over to the left.

Here is a copy and paste from my word document I paste the log into.


```
[FONT=Courier New][SIZE=3]           C:\users\Public\[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\desktop.ini[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]           C:\users\Public\Desktop\[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Desktop\CamStudio.lnk[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Desktop\CPUID CPU-Z.lnk[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Desktop\DAZ Studio 3.lnk[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Desktop\desktop.ini[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Desktop\FineCrypt.lnk[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Desktop\Wireshark.lnk[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]           C:\users\Public\Documents\[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Documents\desktop.ini[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]           C:\users\Public\Documents\microsoft\[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]           C:\users\Public\Documents\microsoft\IdentityCRL\[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]           C:\users\Public\Documents\microsoft\IdentityCRL\production\[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]           C:\users\Public\Downloads\[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Downloads\desktop.ini[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]           C:\users\Public\Favorites\[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]           C:\users\Public\Music\[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Music\desktop.ini[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]           C:\users\Public\Music\Sample Music\[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Music\Sample Music\AlbumArt_{208F236E-B511-4949-BDF9-3791602ED53A}_Large.jpg[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Music\Sample Music\AlbumArt_{208F236E-B511-4949-BDF9-3791602ED53A}_Small.jpg[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Music\Sample Music\AlbumArt_{2BEDE989-0477-48C8-8E85-D5FC97494EC0}_Large.jpg[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Music\Sample Music\AlbumArt_{2BEDE989-0477-48C8-8E85-D5FC97494EC0}_Small.jpg[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Music\Sample Music\AlbumArt_{81244B04-70BE-47F1-9A5E-2026093D598F}_Large.jpg[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Music\Sample Music\AlbumArt_{81244B04-70BE-47F1-9A5E-2026093D598F}_Small.jpg[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Music\Sample Music\AlbumArt_{CA6465E3-92B8-4969-B053-E091250B3E3E}_Large.jpg[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Music\Sample Music\AlbumArt_{CA6465E3-92B8-4969-B053-E091250B3E3E}_Small.jpg[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Music\Sample Music\AlbumArt_{D4213C57-0F32-4AED-82E0-A6560E1EA35F}_Large.jpg[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Music\Sample Music\AlbumArt_{D4213C57-0F32-4AED-82E0-A6560E1EA35F}_Small.jpg[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Music\Sample Music\AlbumArt_{DAAE5A7A-D07D-4C7C-AE7B-E926C737721B}_Large.jpg[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Music\Sample Music\AlbumArt_{DAAE5A7A-D07D-4C7C-AE7B-E926C737721B}_Small.jpg[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Music\Sample Music\AlbumArt_{F87D14E5-4DEB-4169-B9EA-D067EBCD4297}_Large.jpg[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Music\Sample Music\AlbumArt_{F87D14E5-4DEB-4169-B9EA-D067EBCD4297}_Small.jpg[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Music\Sample Music\AlbumArtSmall.jpg[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Music\Sample Music\Amanda.wma[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Music\Sample Music\desktop.ini[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Music\Sample Music\Despertar.wma[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Music\Sample Music\Din Din Wo (Little Child).wma[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Music\Sample Music\Distance.wma[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Music\Sample Music\Folder.jpg[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Music\Sample Music\I Guess You're Right.wma[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Music\Sample Music\I Ka Barra (Your Work).wma[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Music\Sample Music\Love Comes.wma[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Music\Sample Music\Muita Bobeira.wma[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Music\Sample Music\OAM's Blues.wma[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Music\Sample Music\One Step Beyond.wma[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Music\Sample Music\Symphony_No_3.wma[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]           C:\users\Public\Pictures\[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Pictures\desktop.ini[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]           C:\users\Public\Pictures\Sample Pictures\[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Pictures\Sample Pictures\Autumn Leaves.jpg[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Pictures\Sample Pictures\Creek.jpg[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Pictures\Sample Pictures\Desert Landscape.jpg[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Pictures\Sample Pictures\desktop.ini[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Pictures\Sample Pictures\Dock.jpg[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Pictures\Sample Pictures\Forest Flowers.jpg[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Pictures\Sample Pictures\Forest.jpg[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Pictures\Sample Pictures\Frangipani Flowers.jpg[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Pictures\Sample Pictures\Garden.jpg[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Pictures\Sample Pictures\Green Sea Turtle.jpg[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Pictures\Sample Pictures\Humpback Whale.jpg[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Pictures\Sample Pictures\Oryx Antelope.jpg[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Pictures\Sample Pictures\Toco Toucan.jpg[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Pictures\Sample Pictures\Tree.jpg[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Pictures\Sample Pictures\Waterfall.jpg[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Pictures\Sample Pictures\Winter Leaves.jpg[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]           C:\users\Public\Videos\[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Videos\desktop.ini[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]           C:\users\Public\Videos\Sample Videos\[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Videos\Sample Videos\Bear.wmv[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Videos\Sample Videos\Butterfly.wmv[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Videos\Sample Videos\desktop.ini[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]                       C:\users\Public\Videos\Sample Videos\Lake.wmv[/SIZE][/FONT]
 
[FONT=Courier New][SIZE=3]------------------------------------------------------------------------------[/SIZE][/FONT]
 
[FONT=Courier New][SIZE=3]               Total    Copied   Skipped  Mismatch    FAILED    Extras[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]    Dirs :        17        14         3         0         0         0[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]   Files :        60        60         0         0         0         0[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]   Bytes :   72.87 m   72.87 m         0         0         0         0[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]   Times :   0:00:50   0:00:49                       0:00:00   0:00:01[/SIZE][/FONT]
 
[FONT=Courier New][SIZE=3]   Speed :             1559057 Bytes/sec.[/SIZE][/FONT]
[FONT=Courier New][SIZE=3]   Speed :              89.209 MegaBytes/min.[/SIZE][/FONT]
 
[FONT=Courier New][SIZE=3]   Ended : Sun Aug 23 22:21:47 2009[/SIZE][/FONT]
```
I would like the text telling you what is being copied to be all the way to the left on the screen and in the log file instead of in the middle. I didn't know if this was possible or not.


----------



## Squashman (Apr 4, 2003)

run the file thru a for loop. By default it uses spaces and tabs as delimiters.


```
for /f "tokens=*" %%a in (log.txt) do echo %%a>>log2.txt
```


----------



## TheOutcaste (Aug 8, 2007)

Even when disabled, it still leaves space for the Progress display and size. If you disable the Class display it does shift it left some.
Would be nice if they would shift things left when the others are disabled, especially the size padding.
You could put the whole command inside a loop, then echo each line to the screen and the log so both would be spaced as you want it.
This will indent the file names by the number of spaces on the Set _Pad= line, and also corrects the Header and summary blocks.
If assumes you don't have a folder or file name that contains *Total*<4 spaces>* Copied*":
It depends on the fact that directory names are outputted with a trailing \

```
@Echo Off
SetLocal EnableDelayedExpansion
:: Set this to the number of spaces you want in front of the file names, if any.
:: This will also affect the Header and Summary. Be sure to add the spaces if copying from the web
Set _Pad=  
Set _LogFile=C:\Test\RoboLog.txt
For /F "Tokens=*" %%I In ('robocopy "C:\Temp Dir\A_Profile" C:\Test /E /copy:DATS /R:1 /w:5 /np /ns /nc /L') Do (
Set _tmp1=%%I
Set _tmp2=%%~nI
If Not Defined _tmp2 (
  If Defined _tmp1 (
    Set _tmp1=!_tmp1:Source :=%_Pad% Source :!
    Set _tmp1=!_tmp1:Dest :=%_Pad%   Dest :!
    Set _tmp1=!_tmp1:Files :=%_Pad%Files :!
    Echo.!_tmp1!
>>"%_LogFile%" Echo.!_tmp1!
  )
) Else (
  Set _tmp1=!_tmp1:Dirs :=%_Pad% Dirs :!
  Set _tmp1=!_tmp1:Files :=%_Pad%Files :!
  Set _tmp1=!_tmp1:Bytes :=%_Pad%Bytes :!
  Set _tmp1=!_tmp1:Times :=%_Pad%Times :!
  Set _tmp1=!_tmp1:Ended :=%_Pad%Ended :!
  Set _tmp1=!_tmp1:Total    Copied=%_Pad%            Total    Copied!
  Echo.%_Pad%!_tmp1!
>>"%_LogFile%" Echo.%_Pad%!_tmp1!
))
```


----------

