Solved How to copy a paragraph from one file to anohter txt file?

July 9, 2012 at 03:56:43
Specs: Windows 7
Hi,
I am trying to copy a paragraph from one text file to new txt file. These are the following detail:

Label comment:
A quick brown fox jump over the little lazy dog.
******
I want to copy "A quick brown fox jump over the lazy dog." into new file through batch script.
Please note that paragraph is ended with *****.

Can anyone please suggest me solution for that.
Thanks in adv.


See More: How to copy a paragraph from one file to anohter txt file?

Report •


✔ Best Answer
July 10, 2012 at 05:57:02
Try this:

@echo off & setlocal enabledelayedexpansion
set file=test.txt
set $=*****
set #=0
if exist $$$.tmp del $$$.tmp
>>$$$.tmp findstr /v /b "Version Label User:" %file%
for /f "skip=1 tokens=*" %%i in (
$$$.tmp
) do (
set line=%%i
if "!line:~0,5!"=="!$!" (
set /a #+=1
) else (
>>file!#!.txt echo %%i
))
for /f %%i in (
'dir /b file*.txt'
) do (
set f=%%~ni&set f=!f:~4!
if %%~zi gtr 4096 echo Label Comment !f! is larger than 4KB
)
>nul del $$$.tmp

Tony



#1
July 10, 2012 at 03:36:39
We Need to see more of the file.


=====================================
Life is too important to be taken seriously.

M2


Report •

#2
July 10, 2012 at 04:04:11
Thanks for your reply....
I have pasted the content of file and I only needed the label comment section in another text file.
These are the following contents:

Building list for $/latestupdae..............

***** FWHFlash.sdl *****
Version 2
Label: "1.0.0.4"
User: Raku Date: 6/08/12 Time: 12:15p
Labeled
Label comment: Instructions to run Mirror.bat
Note, however, that variables are not generally global across command console sessions.
[]
Use a file or the registry in that case or find one of the utilities that puts
environment variables in the 'master' environment. One I can think of is called SETX,

though I've never used it. Such 'permanent' variables can also be set manually in the My
Computer properties Advanced Environment Variables Windows dialog.

***** Flash *****
Version 14
Label: "1.0.0.3"
User: Raku Date: 5/17/12 Time: 3:34p
Labeled
Label comment: Instructions to run Mirror.bat
Note, however, that variables are not generally global across command console sessions.
Use a file or the registry in that case or find one of the utilities that puts
environment variables in the 'master' environment. One I can think of is called SETX,

though I've never used it. Such 'permanent' variables can also be set manually in the My
Computer properties Advanced Environment Variables Windows dialog.

***** Flash *****
Version 13
Label: "1.0.0.2"
User: Raku Date: 5/17/12 Time: 3:33p
Labeled
Label comment: Instructions to run Mirror.bat
Note, however, that variables are not generally global across command console sessions.
Use a file or the registry in that case or find one of the utilities that puts
environment variables in the 'master' environment. One I can think of is called SETX,

though I've never used it. Such 'permanent' variables can also be set manually in the My
Computer properties Advanced Environment Variables Windows dialog.


Report •

#3
July 10, 2012 at 04:20:56
There are three ocurrances of:

Label comment: Instructions to run Mirror.bat

Do you want three sectionS? Or one?


=====================================
Life is too important to be taken seriously.

M2


Report •

Related Solutions

#4
July 10, 2012 at 04:34:04
At a time only one label comment section copy in another text file(say temp.txt). After that I want to calculate the size of file (Temp.txt) and if the size of file is greater than 4kb display msg(Like comment size is more than 4kb). And then loop going in section comment and repeat the procedure till end of file....

Report •

#5
July 10, 2012 at 04:36:53
actually my aim is calculate the size of each label comment.

Report •

#6
July 10, 2012 at 05:24:11
Is the bolded section below a mistake or actually in the file?

Note, however, that variables are not generally global across command console sessions.
[]
Use a file or the registry in that case or find one of the utilities that puts
environment variables in the 'master' environment. One I can think of is called SETX,
though I've never used it. Such 'permanent' variables can also be set manually in the My
Computer properties Advanced Environment Variables Windows dialog.

Also, is each section always 11 lines?

Tony


Report •

#7
July 10, 2012 at 05:57:02
✔ Best Answer
Try this:

@echo off & setlocal enabledelayedexpansion
set file=test.txt
set $=*****
set #=0
if exist $$$.tmp del $$$.tmp
>>$$$.tmp findstr /v /b "Version Label User:" %file%
for /f "skip=1 tokens=*" %%i in (
$$$.tmp
) do (
set line=%%i
if "!line:~0,5!"=="!$!" (
set /a #+=1
) else (
>>file!#!.txt echo %%i
))
for /f %%i in (
'dir /b file*.txt'
) do (
set f=%%~ni&set f=!f:~4!
if %%~zi gtr 4096 echo Label Comment !f! is larger than 4KB
)
>nul del $$$.tmp

Tony


Report •

#8
July 10, 2012 at 05:58:52
Hi Tony,
Just I have pasted the as a format of comment. For each comment may be changed by user when next time generate that txt file. [] this is not mistake. I have a solution but its not working : You see before the label comment starting, There is "lebeled" its generated automatically. Now I we take that is the starting point and "*****" is ending point and copy that section and paste into temp.txt file. I have uses that code :
SET Flag=0
type nul>tmp.txt
@FOR /F "Tokens=* delims=" %%i in (HISTORY.TXT) dO (
@IF /I "%%i" == "Labeled" (SET Flag=1)
SET str=%%i
SET str=%str:~0,5%
@IF /i "%str%"= "*****" ( SET Flag=0)
@IF "!Flag!" EQU 1 echo %%i>>tmp.txt
)

But when I am trying to set str=%%i. str not storing that value.

Please suggest me why str not storing the value of %%i.
@IF "!Flag!" EQU 1 echo %%i>>tmp.txt


Report •

#9
July 10, 2012 at 06:01:11
My solution should work for most input files with your requirement. Give it a try and let us know. Just change the set file=test.txt line to set file=yourfile.txt where yourfile.txt is the name of your input file.

To answer your question why your variable isn't being set; when setting vars within a FOR loop you have to use delayed variable expansion. Somewhere before your FOR loop you need to have setlocal enabledelayedexpansion. When using delayed expansion you surround vars with !'s instead of %'s like this:

!var!

Tony


Report •

#10
July 10, 2012 at 06:17:10
Here's a version you can run from the command line:
Use it like any other command line utility:

script.bat input.txt

@echo off & setlocal enabledelayedexpansion
set file=%~1
set $=*****
set #=0
if exist $$$.tmp del $$$.tmp
>>$$$.tmp findstr /v /b "Version Label User:" %file%
for /f "skip=1 tokens=*" %%i in (
$$$.tmp
) do (
set line=%%i
if "!line:~0,5!"=="!$!" (
set /a #+=1
) else (
>>file!#!.txt echo %%i
))
for /f %%i in (
'dir /b file*.txt'
) do (
set f=%%~ni&set f=!f:~4!
if %%~zi gtr 4096 echo Label Comment !f! is larger than 4KB
)
>nul del $$$.tmp

Tony


Report •

#11
July 10, 2012 at 06:30:03
@Echo off

SET PATH=%ProgramFiles%\Microsoft Visual Studio\Common\VSS\win32;%PATH%
SET VSS=C:\Program Files\Microsoft Visual Studio\Common\VSS\win32\SS.exe

SetLocal EnableDelayedExpansion
@IF EXIST DIR_LIST.TXT @del /Q /F DIR_LIST.TXT
@IF EXIST HISTORY.TXT @del /Q /F HISTORY.TXT
@"SS.exe" Dir $/latestupdae -Y%admin% -R >DIR_LIST.TXT
@FOR /F "delims=:" %%A in ('FINDSTR ":" DIR_LIST.TXT') DO (
SET FOLDER_PATH=%%A
REM Get the recursive label history of the folder and redirect to a file.
@for /F "tokens=2*" %%X in ("%date%") do ( SET CUR_DATE=%%X )
REM In HISTORY.TXT getting the histroy of each file
@"SS.exe" History "!FOLDER_PATH!" -Y%admin% -L -V"!CUR_DATE!" -I- -OHISTORY.TXT
REM put the HISTORY.TXT AS A INPUT OF FILE
set file=HISTORY.TXT
set $=*****
set #=0
if exist $$$.tmp del $$$.tmp
>>$$$.tmp findstr /v /b "Version [0-9] Label User:" %file%
for /f "skip=1 tokens=*" %%i in (
$$$.tmp
) do (
set line=%%i
if "!line:~0,5!"=="!$!" (
set /a #+=1
) else (
>>file!#!.txt echo %%i
))
for /f %%i in (
'dir /b file*.txt'
) do (
set f=%%~ni&set f=!f:~4!
if %%~zi gtr 4096 echo Label Comment !f! is larger than 4KB
)
>nul del $$$.tmp
)
I have tried with code but It is running in infinite loop. I am also putting the HISTORY.TXT file for your reference.
Please note that I have applied the same label comment for each file(Only for test purpose). User can put any comment.
Contents of HISTORY.TXT:
uilding list for $/latestupdae..............

***** FWHFlash.sdl *****
Version 2
Label: "1.0.0.4"
User: Raku Date: 6/08/12 Time: 12:15p
Labeled
Label comment: Instructions to run Mirror.bat

[Pre-requisites]
* Export the filter information from RSC using Admin tool [select Action->Export Configuration->Export folder configuration menu in Admin tool]
- This will generate FilterInfo.csv
* Ensure the VSS variable in the batch file points to the VSS installed location.
* Ensure whether the user name and password for original DB and mirror DB in batch file is correct to perform VSS operations

[Command]
Mirror.bat <Alias_Name> <Source_DB> <MIRROR_DB> <FilterInfo.csv> <USER_GROUP_NAME> [From_Date]
E.g: Mirror.bat FTS \\util_dev2\Alaska D:\MirrorDB FilterInfo.csv cust_fts 1/1/2009

Note: If [From_Date] is not provided then all the labels of the DB are verified.
If it is provided then the labels that fall within the range [From_Date] to Current_Date are verified.

[OUTPUT]

The batch file output will be available in OUTPUT.TXT in the location of the bat file.

The following are the log messages,

<FILES_PATH>;<LABEL> = <OK>/<FAILED>
The result of comparison of a file at particular label from original DB and mirror DB.

File <File_Name> at label <Label_Name> not available in <Mirror_DB> DB = FAILED

This message is logged when mirror DB does not have the particular file whereas original DB has the file or when the particular file couldn’t be retrieved successfully from mirror DB whereas successfully retrieved from original DB.

Instructions to run Mirror.bat

[Pre-requisites]
* Export the filter information from RSC using Admin tool [select Action->Export Configuration->Export folder configuration menu in Admin tool]
- This will generate FilterInfo.csv
* Ensure the VSS variable in the batch file points to the VSS installed location.
* Ensure whether the user name and password for original DB and mirror DB in batch file is correct to perform VSS operations

[Command]
Mirror.bat <Alias_Name> <Source_DB> <MIRROR_DB> <FilterInfo.csv> <USER_GROUP_NAME> [From_Date]
E.g: Mirror.bat FTS \\util_dev2\Alaska D:\MirrorDB FilterInfo.csv cust_fts 1/1/2009
Instructions to run Mirror.bat

[Pre-requisites]
* Export the filter information from RSC using Admin tool [select Action->Export Configuration->Export folder configuration menu in Admin tool]
- This will generate FilterInfo.csv
* Ensure the VSS variable in the batch file points to the VSS installed location.
* Ensure whether the user name and password for original DB and mirror DB in batch file is correct to perform VSS operations

[Command]
Mirror.bat <Alias_Name> <Source_DB> <MIRROR_DB> <FilterInfo.csv> <USER_GROUP_NAME> [From_Date]
E.g: Mirror.bat FTS \\util_dev2\Alaska D:\MirrorDB FilterInfo.csv cust_fts 1/1/2009

Note: If [From_Date] is not provided then all the labels of the DB are verified.
If it is provided then the labels that fall within the range [From_Date] to Current_Date are verified.

[OUTPUT]

The batch file output will be available in OUTPUT.TXT in the location of the bat file.

The following are the log messages,

<FILES_PATH>;<LABEL> = <OK>/<FAILED>
The result of comparison of a file at particular label from original DB and mirror DB.

File <File_Name> at label <Label_Name> not available in <Mirror_DB> DB = FAILED

This message is logged when mirror DB does not have the particular file whereas original DB has the file or when the particular file couldn’t be retrieved successfully from mirror DB whereas successfully retrieved from original DB.

Instructions to run Mirror.bat


[Pre-requisites]
* Export the filter information from RSC using Admin tool [select Action->Export Configuration->Export folder configuration menu in Admin tool]
- This will generate FilterInfo.csv
* Ensure the VSS variable in the batch file points to the VSS installed location.
* Ensure whether the user name and password for original DB and mirror DB in batch file is correct to perform VSS operations

[Command]
Mirror.bat <Alias_Name> <Source_DB> <MIRROR_DB> <FilterInfo.csv> <USER_GROUP_NAME> [From_Date]
E.g: Mirror.bat FTS \\util_dev2\Alaska D:\MirrorDB FilterInfo.csv cust_fts 1/1/2009

Note: If [From_Date] is not provided then all the labels of the DB are verified.
If it is provided then the labels that fall within the range [From_Date] to Current_Date are verified.

[OUTPUT]

The batch file output will be available in OUTPUT.TXT in the location of the bat file.

The following are the log messages,

<FILES_PATH>;<LABEL> = <OK>/<FAILED>
The result of comparison of a file at particular label from original DB and mirror DB.

File <File_Name> at label <Label_Name> not available in <Mirror_DB> DB = FAILED

This message is logged when mirror DB does not have the particular file whereas original DB has the file or when the particular file couldn’t be retrieved successfully from mirror DB whereas successfully retrieved from original DB.


Note: If [From_Date] is not provided then all the labels of the DB are verified.
If it is provided then the labels that fall within the range [From_Date] to Current_Date are verified.

[OUTPUT]

The batch file output will be available in OUTPUT.TXT in the location of the bat file.

The following are the log messages,

<FILES_PATH>;<LABEL> = <OK>/<FAILED>
The result of comparison of a file at particular label from original DB and mirror DB.

File <File_Name> at label <Label_Name> not available in <Mirror_DB> DB = FAILED

This message is logged when mirror DB does not have the particular file whereas original DB has the file or when the particular file couldn’t be retrieved successfully from mirror DB whereas successfully retrieved from original DB.

Instructions to run Mirror.bat

[Pre-requisites]
* Export the filter information from RSC using Admin tool [select Action->Export Configuration->Export folder configuration menu in Admin tool]
- This will generate FilterInfo.csv
* Ensure the VSS variable in the batch file points to the VSS installed location.
* Ensure whether the user name and password for original DB and mirror DB in batch file is correct to perform VSS operations

[Command]
Mirror.bat <Alias_Name> <Source_DB> <MIRROR_DB> <FilterInfo.csv> <USER_GROUP_NAME> [From_Date]
E.g: Mirror.bat FTS \\util_dev2\Alaska D:\MirrorDB FilterInfo.csv cust_fts 1/1/2009

Note: If [From_Date] is not provided then all the labels of the DB are verified.
If it is provided then the labels that fall within the range [From_Date] to Current_Date are verified.

[OUTPUT]

The batch file output will be available in OUTPUT.TXT in the location of the bat file.

The following are the log messages,

<FILES_PATH>;<LABEL> = <OK>/<FAILED>
The result of comparison of a file at particular label from original DB and mirror DB.

File <File_Name> at label <Label_Name> not available in <Mirror_DB> DB = FAILED

This message is logged when mirror DB does not have the particular file whereas original DB has the file or when the particular file couldn’t be retrieved successfully from mirror DB whereas successfully retrieved from original DB.

Instructions to run Mirror.bat

[Pre-requisites]
* Export the filter information from RSC using Admin tool [select Action->Export Configuration->Export folder configuration menu in Admin tool]
- This will generate FilterInfo.csv
* Ensure the VSS variable in the batch file points to the VSS installed location.
* Ensure whether the user name and password for original DB and mirror DB in batch file is correct to perform VSS operations

[Command]
Mirror.bat <Alias_Name> <Source_DB> <MIRROR_DB> <FilterInfo.csv> <USER_GROUP_NAME> [From_Date]
E.g: Mirror.bat FTS \\util_dev2\Alaska D:\MirrorDB FilterInfo.csv cust_fts 1/1/2009

Note: If [From_Date] is not provided then all the labels of the DB are verified.
If it is provided then the labels that fall within the range [From_Date] to Current_Date are verified.

[OUTPUT]

The batch file output will be available in OUTPUT.TXT in the location of the bat file.

The following are the log messages,

<FILES_PATH>;<LABEL> = <OK>/<FAILED>
The result of comparison of a file at particular label from original DB and mirror DB.

File <File_Name> at label <Label_Name> not available in <Mirror_DB> DB = FAILED

This message is logged when mirror DB does not have the particular file whereas original DB has the file or when the particular file couldn’t be retrieved successfully from mirror DB whereas successfully retrieved from original DB.


Instructions to run Mirror.bat

[Pre-requisites]
* Export the filter information from RSC using Admin tool [select Action->Export Configuration->Export folder configuration menu in Admin tool]
- This will generate FilterInfo.csv
* Ensure the VSS variable in the batch file points to the VSS installed location.
* Ensure whether the user name and password for original DB and mirror DB in batch file is correct to perform VSS operations

[Command]
Mirror.bat <Alias_Name> <Source_DB> <MIRROR_DB> <FilterInfo.csv> <USER_GROUP_NAME> [From_Date]
E.g: Mirror.bat FTS \\util_dev2\Alaska D:\MirrorDB FilterInfo.csv cust_fts 1/1/2009

Note: If [From_Date] is not provided then all the labels of the DB are verified.
If it is provided then the labels that fall within the range [From_Date] to Current_Date are verified.

[OUTPUT]

The batch file output will be available in OUTPUT.TXT in the location of the bat file.

The following are the log messages,

<FILES_PATH>;<LABEL> = <OK>/<FAILED>
The result of comparison of a file at particular label from original DB and mirror DB.

File <File_Name> at label <Label_Name> not available in <Mirror_DB> DB = FAILED

This message is logged when mirror DB does not have the particular file whereas original DB has the file or when the particular file couldn’t be retrieved successfully from mirror DB whereas successfully retrieved from original DB.

***** Flash *****
Version 14
Label: "1.0.0.3"
User: Raku Date: 5/17/12 Time: 3:34p
Labeled
Label comment: Instructions to run Mirror.bat

[Pre-requisites]
* Export the filter information from RSC using Admin tool [select Action->Export Configuration->Export folder configuration menu in Admin tool]
- This will generate FilterInfo.csv
* Ensure the VSS variable in the batch file points to the VSS installed location.
* Ensure whether the user name and password for original DB and mirror DB in batch file is correct to perform VSS operations

[Command]
Mirror.bat <Alias_Name> <Source_DB> <MIRROR_DB> <FilterInfo.csv> <USER_GROUP_NAME> [From_Date]
E.g: Mirror.bat FTS \\util_dev2\Alaska D:\MirrorDB FilterInfo.csv cust_fts 1/1/2009

Note: If [From_Date] is not provided then all the labels of the DB are verified.
If it is provided then the labels that fall within the range [From_Date] to Current_Date are verified.

[OUTPUT]

The batch file output will be available in OUTPUT.TXT in the location of the bat file.

The following are the log messages,

<FILES_PATH>;<LABEL> = <OK>/<FAILED>
The result of comparison of a file at particular label from original DB and mirror DB.

File <File_Name> at label <Label_Name> not available in <Mirror_DB> DB = FAILED

This message is logged when mirror DB does not have the particular file whereas original DB has the file or when the particular file couldn’t be retrieved successfully from mirror DB whereas successfully retrieved from original DB.

Instructions to run Mirror.bat

[Pre-requisites]
* Export the filter information from RSC using Admin tool [select Action->Export Configuration->Export folder configuration menu in Admin tool]
- This will generate FilterInfo.csv
* Ensure the VSS variable in the batch file points to the VSS installed location.
* Ensure whether the user name and password for original DB and mirror DB in batch file is correct to perform VSS operations

[Command]
Mirror.bat <Alias_Name> <Source_DB> <MIRROR_DB> <FilterInfo.csv> <USER_GROUP_NAME> [From_Date]
E.g: Mirror.bat FTS \\util_dev2\Alaska D:\MirrorDB FilterInfo.csv cust_fts 1/1/2009
Instructions to run Mirror.bat

[Pre-requisites]
* Export the filter information from RSC using Admin tool [select Action->Export Configuration->Export folder configuration menu in Admin tool]
- This will generate FilterInfo.csv
* Ensure the VSS variable in the batch file points to the VSS installed location.
* Ensure whether the user name and password for original DB and mirror DB in batch file is correct to perform VSS operations

[Command]
Mirror.bat <Alias_Name> <Source_DB> <MIRROR_DB> <FilterInfo.csv> <USER_GROUP_NAME> [From_Date]
E.g: Mirror.bat FTS \\util_dev2\Alaska D:\MirrorDB FilterInfo.csv cust_fts 1/1/2009

Note: If [From_Date] is not provided then all the labels of the DB are verified.
If it is provided then the labels that fall within the range [From_Date] to Current_Date are verified.

[OUTPUT]

The batch file output will be available in OUTPUT.TXT in the location of the bat file.

The following are the log messages,

<FILES_PATH>;<LABEL> = <OK>/<FAILED>
The result of comparison of a file at particular label from original DB and mirror DB.

File <File_Name> at label <Label_Name> not available in <Mirror_DB> DB = FAILED

This message is logged when mirror DB does not have the particular file whereas original DB has the file or when the particular file couldn’t be retrieved successfully from mirror DB whereas successfully retrieved from original DB.

Instructions to run Mirror.bat


[Pre-requisites]
* Export the filter information from RSC using Admin tool [select Action->Export Configuration->Export folder configuration menu in Admin tool]
- This will generate FilterInfo.csv
* Ensure the VSS variable in the batch file points to the VSS installed location.
* Ensure whether the user name and password for original DB and mirror DB in batch file is correct to perform VSS operations

[Command]
Mirror.bat <Alias_Name> <Source_DB> <MIRROR_DB> <FilterInfo.csv> <USER_GROUP_NAME> [From_Date]
E.g: Mirror.bat FTS \\util_dev2\Alaska D:\MirrorDB FilterInfo.csv cust_fts 1/1/2009

Note: If [From_Date] is not provided then all the labels of the DB are verified.
If it is provided then the labels that fall within the range [From_Date] to Current_Date are verified.

[OUTPUT]

The batch file output will be available in OUTPUT.TXT in the location of the bat file.

The following are the log messages,

<FILES_PATH>;<LABEL> = <OK>/<FAILED>
The result of comparison of a file at particular label from original DB and mirror DB.

File <File_Name> at label <Label_Name> not available in <Mirror_DB> DB = FAILED

This message is logged when mirror DB does not have the particular file whereas original DB has the file or when the particular file couldn’t be retrieved successfully from mirror DB whereas successfully retrieved from original DB.


Note: If [From_Date] is not provided then all the labels of the DB are verified.
If it is provided then the labels that fall within the range [From_Date] to Current_Date are verified.

[OUTPUT]

The batch file output will be available in OUTPUT.TXT in the location of the bat file.

The following are the log messages,

<FILES_PATH>;<LABEL> = <OK>/<FAILED>
The result of comparison of a file at particular label from original DB and mirror DB.

File <File_Name> at label <Label_Name> not available in <Mirror_DB> DB = FAILED

This message is logged when mirror DB does not have the particular file whereas original DB has the file or when the particular file couldn’t be retrieved successfully from mirror DB whereas successfully retrieved from original DB.

Instructions to run Mirror.bat

[Pre-requisites]
* Export the filter information from RSC using Admin tool [select Action->Export Configuration->Export folder configuration menu in Admin tool]
- This will generate FilterInfo.csv
* Ensure the VSS variable in the batch file points to the VSS installed location.
* Ensure whether the user name and password for original DB and mirror DB in batch file is correct to perform VSS operations

[Command]
Mirror.bat <Alias_Name> <Source_DB> <MIRROR_DB> <FilterInfo.csv> <USER_GROUP_NAME> [From_Date]
E.g: Mirror.bat FTS \\util_dev2\Alaska D:\MirrorDB FilterInfo.csv cust_fts 1/1/2009

Note: If [From_Date] is not provided then all the labels of the DB are verified.
If it is provided then the labels that fall within the range [From_Date] to Current_Date are verified.

[OUTPUT]

The batch file output will be available in OUTPUT.TXT in the location of the bat file.

The following are the log messages,

<FILES_PATH>;<LABEL> = <OK>/<FAILED>
The result of comparison of a file at particular label from original DB and mirror DB.

File <File_Name> at label <Label_Name> not available in <Mirror_DB> DB = FAILED

This message is logged when mirror DB does not have the particular file whereas original DB has the file or when the particular file couldn’t be retrieved successfully from mirror DB whereas successfully retrieved from original DB.

Instructions to run Mirror.bat

[Pre-requisites]
* Export the filter information from RSC using Admin tool [select Action->Export Configuration->Export folder configuration menu in Admin tool]
- This will generate FilterInfo.csv
* Ensure the VSS variable in the batch file points to the VSS installed location.
* Ensure whether the user name and password for original DB and mirror DB in batch file is correct to perform VSS operations

[Command]
Mirror.bat <Alias_Name> <Source_DB> <MIRROR_DB> <FilterInfo.csv> <USER_GROUP_NAME> [From_Date]
E.g: Mirror.bat FTS \\util_dev2\Alaska D:\MirrorDB FilterInfo.csv cust_fts 1/1/2009

Note: If [From_Date] is not provided then all the labels of the DB are verified.
If it is provided then the labels that fall within the range [From_Date] to Current_Date are verified.

[OUTPUT]

The batch file output will be available in OUTPUT.TXT in the location of the bat file.

The following are the log messages,

<FILES_PATH>;<LABEL> = <OK>/<FAILED>
The result of comparison of a file at particular label from original DB and mirror DB.

File <File_Name> at label <Label_Name> not available in <Mirror_DB> DB = FAILED

This message is logged when mirror DB does not have the particular file whereas original DB has the file or when the particular file couldn’t be retrieved successfully from mirror DB whereas successfully retrieved from original DB.


Instructions to run Mirror.bat

[Pre-requisites]
* Export the filter information from RSC using Admin tool [select Action->Export Configuration->Export folder configuration menu in Admin tool]
- This will generate FilterInfo.csv
* Ensure the VSS variable in the batch file points to the VSS installed location.
* Ensure whether the user name and password for original DB and mirror DB in batch file is correct to perform VSS operations

[Command]
Mirror.bat <Alias_Name> <Source_DB> <MIRROR_DB> <FilterInfo.csv> <USER_GROUP_NAME> [From_Date]
E.g: Mirror.bat FTS \\util_dev2\Alaska D:\MirrorDB FilterInfo.csv cust_fts 1/1/2009

Note: If [From_Date] is not provided then all the labels of the DB are verified.
If it is provided then the labels that fall within the range [From_Date] to Current_Date are verified.

[OUTPUT]

The batch file output will be available in OUTPUT.TXT in the location of the bat file.

The following are the log messages,

<FILES_PATH>;<LABEL> = <OK>/<FAILED>
The result of comparison of a file at particular label from original DB and mirror DB.

File <File_Name> at label <Label_Name> not available in <Mirror_DB> DB = FAILED

This message is logged when mirror DB does not have the particular file whereas original DB has the file or when the particular file couldn’t be retrieved successfully from mirror DB whereas successfully retrieved from original DB.

***** Flash *****
Version 13
Label: "1.0.0.2"
User: Raku Date: 5/17/12 Time: 3:33p
Labeled
Label comment:


Report •

#12
July 10, 2012 at 06:52:11
My code works fine against that file as well. I don't know what you're trying to do with all that other code.

Tony


Report •

#13
July 10, 2012 at 07:08:57
Thanks..thanks a lot for your help..it is working fine.....

Report •

#14
July 11, 2012 at 01:49:59
:: ===== script starts here ===============
::
:: raku2.bat 2012-07-10 18:53:11.96
@echo off & setLocal enableDELAYedeXpansioN

if exist FILE* del FILE*
set N=

for /f "tokens=1-2* delims= " %%a in (RAKU88-1.TXT) do (
if "%%a %%b" equ "Label comment:" set /a N+=1
if defined N >> FILE!N! echo.%%a %%b %%c
)

for /f "tokens=* delims= " %%a in ('dir/b FILE*') do (
if %%~Za gtr 4000 echo %%a is %%~Za
)
goto :eof

::====== script ends here =================


=====================================
Life is too important to be taken seriously.

M2


Report •

#15
July 11, 2012 at 03:09:03
Thanks for your help.... Yesterday I have got the solution from your side.

Report •


Ask Question