File comaprision using batch file
Closed
WENzER
-
9 Mar 2010 à 23:32
Richard.Williams Posts 25 Registration date Saturday 7 November 2009 Status Member Last seen 18 July 2012 - 21 Mar 2010 à 11:51
Richard.Williams Posts 25 Registration date Saturday 7 November 2009 Status Member Last seen 18 July 2012 - 21 Mar 2010 à 11:51
Related:
- File comaprision using batch file
- Dvi file - Guide
- Windows 10 iso file download 64-bit - Download - Windows
- Pokemon emerald rom file - Download - Role playing
- How to open .ps file - Guide
- Pokemon black nds file - Download - Role playing
3 responses
Richard.Williams
Posts
25
Registration date
Saturday 7 November 2009
Status
Member
Last seen
18 July 2012
14
17 Mar 2010 à 10:05
17 Mar 2010 à 10:05
No, the scripts I posted are windows scripts. Install biterscripting, and run the scripts on two test root folders.
Richard.Williams
Posts
25
Registration date
Saturday 7 November 2009
Status
Member
Last seen
18 July 2012
14
15 Mar 2010 à 10:18
15 Mar 2010 à 10:18
Let's first write a script that will compare files (existance) in two folders ( not subfolders )
Copy and paste this script into file C:/Scripts/CompareFolders.txt.
Let's now write another script that will compare two root folders, using the above CompareFolders.txt script.
Copy and paste this script into file C:/Scripts/CompareRoots.txt.
These scripts are in biterscripting. Start biterscripting and enter this command.
It will compare all folders and subfolders, at all levels, within C:/testfolder1 and C:/testfolder2. It will show you a list of folders and subfolders that don't match.
I have seen such scripts used for comparing two computeres. If you are trying to do that, when comparing the entire hard drives on two computers, the script will take some time to complete, before you see any output.
# Script CompareFolders.txt
var str folder1, folder2, list1, list2
lf -n "*" $folder1 ($ftype=="f") > $list1
lf -n "*" $folder2 ($ftype=="f") > $list2
if ($list1 <> $list2)
echo "Folders " $folder1 " and " $folder2 " are different."
endif
Copy and paste this script into file C:/Scripts/CompareFolders.txt.
Let's now write another script that will compare two root folders, using the above CompareFolders.txt script.
# Script CompareRoots.txt
var str roo1, root2, list1, list2, folder1, folder2
lf -r -n "*" $root1 ($ftype=="d") > $list1
lf -r -n "*" $root2 ($ftype=="d") > $list2
while ($list1 <> "")
do
lex "1" $list1 > $folder1
lex "1" $list2 > $folder2
script "C:/Scripts/CompareFolders.txt" folder1($folder1) folder2($folder2)
done
Copy and paste this script into file C:/Scripts/CompareRoots.txt.
These scripts are in biterscripting. Start biterscripting and enter this command.
script "C:/Scripts/CompareRoots.txt" root1("C:/testfolder1") root2("C:/testfolder2")
It will compare all folders and subfolders, at all levels, within C:/testfolder1 and C:/testfolder2. It will show you a list of folders and subfolders that don't match.
I have seen such scripts used for comparing two computeres. If you are trying to do that, when comparing the entire hard drives on two computers, the script will take some time to complete, before you see any output.
But its a unix script, for dat one must have Unix box. What if I want to use only Dos command.
And My actual problem is:
I have two folders with sub folders. One folder is base folder other one is local folder.These folders & subfolders consist of identical as well as non identical files. I want to compare these folders and report the result in some other file. This report must consist of
1. List of All identical files
2. List of All modified files
3. List of Any missing file or folder
4. List of All non identical file
I have tried following script. But it has given only the file difference and missing file.
for /f "delims=" %%a in ('dir/b/a-d c:\test\1') do (
if exist "C:\test\2\%%a" (
fc "c:\test\%%a" "C:\test1\%%a" >> compare.log
) else (
echo %%a is missing >> missing.log
)
)
And My actual problem is:
I have two folders with sub folders. One folder is base folder other one is local folder.These folders & subfolders consist of identical as well as non identical files. I want to compare these folders and report the result in some other file. This report must consist of
1. List of All identical files
2. List of All modified files
3. List of Any missing file or folder
4. List of All non identical file
I have tried following script. But it has given only the file difference and missing file.
for /f "delims=" %%a in ('dir/b/a-d c:\test\1') do (
if exist "C:\test\2\%%a" (
fc "c:\test\%%a" "C:\test1\%%a" >> compare.log
) else (
echo %%a is missing >> missing.log
)
)
19 Mar 2010 à 01:05
21 Mar 2010 à 11:51
Use something like this
var str file1, file2, content1, content2
cat $file1 > $content1
cat $file2 > $content2
if ( $content1 <> $content2)
echo "Files " $file1 " and " $file2 " have different content."
endif
If the files are binary, use the -h flag in the cat command.