need a script to split inputs to a-m and n-z for robocopy

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
redclawkefar
Posts: 13
Joined: 20 Nov 2012 16:04

Re: need a script to split inputs to a-m and n-z for robocop

#16 Post by redclawkefar » 10 Dec 2012 16:44

ugh.

go figure, now i get:

The input line is too long.

ok... time to think why it doesn't like 384 directories to exclude. besides the fact its a ton of folders... any ideas?

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: need a script to split inputs to a-m and n-z for robocop

#17 Post by foxidrive » 10 Dec 2012 17:12

The command line has a length limit. 2 KB in W2k and 8 KB in XP.

Robocopy may have it's own length limit, if that is what you were using.
I think Robocopy can use a configuration file with the exclusions in it, to get over the line length.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: need a script to split inputs to a-m and n-z for robocop

#18 Post by foxidrive » 10 Dec 2012 17:26

Are you creating a mirror backup, or just backing up files and leaving what is already there?

If so then xcopy might be an option and it can also exclude things using a configuration file.

redclawkefar
Posts: 13
Joined: 20 Nov 2012 16:04

Re: need a script to split inputs to a-m and n-z for robocop

#19 Post by redclawkefar » 11 Dec 2012 18:00

yes, i am using robocopy with the /mir switch.... so mirroring and not just doing a backup.

ok, in regards to a config file... that brings it back to what i've already had to some degree.


just thinking out loud here....
---------------
if we run a script pre-robocopy to create a csv file of the folders that NEED to be copied.

then use that csv to "make" those directories in the target drive.

then use each folder from the csv in the 'source' portion of robocopy and then also use it define the 'destination' folder, it might work.
---------------
ok, so what do you think about that approach? or have any other idea?

thanks,
m

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: need a script to split inputs to a-m and n-z for robocop

#20 Post by foxidrive » 12 Dec 2012 00:46

You had that solution here - no CSV files needed: viewtopic.php?p=22310#p22310

redclawkefar
Posts: 13
Joined: 20 Nov 2012 16:04

Re: need a script to split inputs to a-m and n-z for robocop

#21 Post by redclawkefar » 13 Dec 2012 08:27

errrr well now i feel dumb.

so, then going back to that solution... in order to not have to go thru 100's of summary files, is there a way to parse the end of the file to report or list all the summaries... kinda like the following all in a txt file:

Code: Select all

Firstfolder summary:
------------------------------------------------------------------------------

                Total    Copied   Skipped  Mismatch    FAILED    Extras
     Dirs :        52         0        52         0         0         0
    Files :         0         0         0         0         0         0
    Bytes :         0         0         0         0         0         0
    Times :   0:00:00   0:00:00                       0:00:00   0:00:00

    Ended : Thu Nov 29 13:42:44 2012

Secondfolder summary:
------------------------------------------------------------------------------

                Total    Copied   Skipped  Mismatch    FAILED    Extras
     Dirs :        52         0        52         0         0         0
    Files :         0         0         0         0         0         0
    Bytes :         0         0         0         0         0         0
    Times :   0:00:00   0:00:00                       0:00:00   0:00:00

    Ended : Thu Nov 29 13:42:44 2012

.
.
.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: need a script to split inputs to a-m and n-z for robocop

#22 Post by foxidrive » 13 Dec 2012 12:53

This takes file.log and creates file2.log:

Code: Select all

@echo off
findstr /i /c:"summary:" /c:"Mismatch" /c:"Dirs :" /c:"Files :" /c:"Bytes :" /c:"Times : " /c:"Ended :" /c:"--------------" file.log >file2.log

redclawkefar
Posts: 13
Joined: 20 Nov 2012 16:04

Re: need a script to split inputs to a-m and n-z for robocop

#23 Post by redclawkefar » 19 Dec 2012 15:25

well, thats that then... i have what i need, thanks to you both.

the code as i'm using them is then as such:

Code: Select all

@echo off
DEL C:\robocopy\logs\ARCHIVE-am.LOG

pushd "E:\Case Archive"
for %%a in (a b c d e f j h i j k l m) do (
for /f "delims=" %%b in ( ' dir /ad /b "%%a*" ' ) do (
C:\robocopy\robocopy.exe "%%b" "I:\Archive Cases\%%b"  /FFT /V /TEE /S /E /COPY:DT /PURGE /MIR /NP /R:0 /W:0 /xd *recycle* "*system volume*" ZZZZ* %unwanted% /xf thumbs.db *.nef /log+:C:\robocopy\logs\ARCHIVE-am.log /eta
)
)
popd

findstr /i /c:"source :" /c:"Mismatch" /c:"Dirs :" /c:"Files :" /c:"Bytes :" /c:"Times : " /c:"Ended :" /c:"-------------------------------------------------------------------------------" C:\robocopy\logs\ARCHIVE-am.LOG >C:\robocopy\logs\ARCHIVE-am-summary.LOG


spits out a summary log file looking like this:

Code: Select all

-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
   Source : E:\Case Archive\AbaXXXXXX v. YYYYY (ZZZ)\
    Files : *.*
Exc Files : thumbs.db
 Exc Dirs : *recycle*
                Total    Copied   Skipped  Mismatch    FAILED    Extras
     Dirs :        13         0        13         0         0         0
    Files :        43         0        43         0         0         0
    Bytes :   86.93 m         0   86.93 m         0         0         0
    Times :   0:00:00   0:00:00                       0:00:00   0:00:00
    Ended : Wed Dec 19 09:45:59 2012
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
   Source : E:\Case Archive\AbeXXXXXX v. YYYYY (ZZZ)\
    Files : *.*
Exc Files : thumbs.db
 Exc Dirs : *recycle*
                Total    Copied   Skipped  Mismatch    FAILED    Extras
     Dirs :       522         0       522         0         0         0
    Files :      6759         0      6759         0         0         0
    Bytes :  24.101 g         0  24.101 g         0         0         0
    Times :   0:00:02   0:00:00                       0:00:00   0:00:02
    Ended : Wed Dec 19 09:46:02 2012
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
   Source : E:\Case Archive\AdaXXX v. YYYYY (ZZZ)\
    Files : *.*
Exc Files : thumbs.db
 Exc Dirs : *recycle*
                Total    Copied   Skipped  Mismatch    FAILED    Extras
     Dirs :        61         0        61         0         0         2
    Files :       542         0       542         0         0         0
    Bytes :   1.492 g         0   1.492 g         0         0         0
    Times :   0:00:00   0:00:00                       0:00:00   0:00:00
    Ended : Wed Dec 19 09:46:02 2012


it looks more organized in the actual log file which is converted to pdf then emailed to me for review.
Last edited by redclawkefar on 19 Dec 2012 18:01, edited 2 times in total.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: need a script to split inputs to a-m and n-z for robocop

#24 Post by foxidrive » 19 Dec 2012 15:45

That's good to hear. Ta.

Just FYI if you use code tags around your pasted logs then they will retain the correct spaces and formatting.

redclawkefar
Posts: 13
Joined: 20 Nov 2012 16:04

Re: need a script to split inputs to a-m and n-z for robocop

#25 Post by redclawkefar » 19 Dec 2012 18:00

heh, looks even better now... thnx again.

Post Reply