|Hi Guru (male/female):|
Need help with script files (vbs/bat) to be run on XP. Want to compare the first 'X' characters of the file name with the rest of the file names in the same directory. X, paths for source directory and path to the matched directory will be entered by the user. So no particular string is being input, but the script itself reads the firs file's name, takes the first X characters and form a string to be compared.
All matching files will be moved to matched directory.
Please note there can be any number matches. Like there can be two, three or n files with the same X number of characters as file name.
I would be grateful if someone can help me write this or point to an application which can perform this particular action, somebody suggested filemonkey/filemonk, i could not figure out how to compare a partial set of characters which are position sesitive in file names.
Here is an example:
To be entered by user:
string length to compare X=3
source directory path = c:\temp1
matched directory path = c:\matched
Files in c:\temp1 =
ABCAAA.txt, ABCBBBBB.txt, ABCD.txt, ABDAAA.txt, BCDEF.txt, BCDGHAW.txt, FGACD.txt and BABC.txt
After running the script/batch file
The first file is ABCAAA.txt, so the script take "ABC" from the files name and search the rest of the files first 3 characters with "ABC". Once match found it transfers the all the matched files.
files transfered since comparison ("ABC") was found, c:\matched = ABCAAA.txt, ABCBBBBB.txt, ABCD.txt, BCDEF.txt, BCDGHAW.txt
files left as no comparison found, c:\temp1 = ABDAAA.txt, FGACD.txt and BABC.txt
Note: Because the position (i.e. start of the file name) is important so BABC.txt was not a matched file even though it has ABC in its name.
Much obliged for any help in this regards
P.S. this is not my homework/assignment, i want to use this to sort the mp3 files. All my native (Hindi music files) file names are in English, and many variations of English characters are used to pronounce the non-english word of Hindi. Number of words translated as title varies too, hence almost no two file names are same, the file size differ too (quality wise)..... so the only way for me is to search limited characters between file names.