Batch script

Closed
guru - 30 May 2010 à 01:44
Richard.Williams Posts 25 Registration date Saturday 7 November 2009 Status Member Last seen 18 July 2012 - 13 Jun 2010 à 13:21
Hello,

Urgently i need a batch script to get similar filenames(in a textfile) with path from two different folders.Can anyone help me pls...

I found few commands to get a filename from a folder and list in a textfile with path - DIR "G:\automation_stuffs\10.4.0" /B/S/A:-D>list76.txt

in above G:\automation_stuffs\10.4.0 is a folder path

and another command to list filename alone from a folder - for /r G:\automation_stuffs\10.4.0 %%g in (*) do echo %%~nxg>>list1.txt

Kindly help me..very very urgent..



Related:

3 responses

Richard.Williams Posts 25 Registration date Saturday 7 November 2009 Status Member Last seen 18 July 2012 14
13 Jun 2010 à 13:21
Use this script. (It will handle file names with spaces and other special characters.)

# Script DetectDuplicate.txt
var string folder1, folder2
var string list1, list2, path2, file2
lf -n "*" $folder1 ($ftype=="f") > $list1
lf -n "*" $folder2 ($ftype=="f") > $list2
while ($list2 <> "")
do
    lex "1" $list2 > $path2
    stex "^/^l[" $path2 > $file2
    if ( { sen ("^"+$file2+"^") $list1 } > 0 )
        # Duplicate file - report to user.
        echo $folder1 "/" $file2 "\n" $folder2 "/" $file2
    endif
done




Script is in biterscripting. Save the script in file C:/Scripts/DetectDuplicate.txt, start biterscripting, enter this command.


script "C:/Scripts/DetectDuplicate.txt" folder1("D/folder1") folder2("D:/folder2")



It will report duplicate files in folders D:/folder1 and D:/folder2.
rizvisa1 Posts 4478 Registration date Thursday 28 January 2010 Status Contributor Last seen 5 May 2022 766
31 May 2010 à 13:26
what you mean by "similar "
similar means same filenames.

I need filenames of same name from two different folders.This filenames should need on a textfile with exact path.And one more requirement is , i need filenames in following format -

For example - folder 1 has two files (file1,file2) in D ridve and folder2 has four files (file0,file1,file2,file3).in D drive.

The output should be as below on seraching file1 and file 2 in folder 1 and folder2 -

D:/folder1/file1
D:/folder2/file1
D:/folder1/file2
D:/folder2/file2
rizvisa1 Posts 4478 Registration date Thursday 28 January 2010 Status Contributor Last seen 5 May 2022 766
1 Jun 2010 à 08:00
Does every thing has to be done in DOS script or can you import the dir listing of the two folders in an excel file and then separate out common files ?
gurusamy Posts 1 Registration date Thursday 3 June 2010 Status Member Last seen 3 June 2010
3 Jun 2010 à 09:55
ANything is fine for me.I need seperate common files in a textfile.Another additional requirement - even need different files listing of two folders.
rizvisa1 Posts 4478 Registration date Thursday 28 January 2010 Status Contributor Last seen 5 May 2022 766
3 Jun 2010 à 11:01
Could you please upload a a zip file with two directory listing on some shared site like https://authentification.site , http://wikisend.com/ etc and post back here the link to allow better understanding