I need a script to automate file moving according to its names rules (II)

I need a vbs script to make the following - inside a directory I have many files which have a similar name (only the 2 last characters are different - for example aaaa10, aaaa11, aaaa12, aaaa13; bbbb10, bbbb12, bbbb13, bbbb14). I need an automatic way to move that group of files that only have the 2 last characters different to a sub-directory with the name corresponding to common characters (for example, for aaaa10, aaaa12, aaaa13, aaaa14 it will create a sub-directory named aaaa, and aaaa10, aaaa12, aaaa13, aaaa14 will be moved inside aaaa). Can you understand what I want ? I do not know to program :( My operating system is Windows XP. If you look at http://www.experts-exchange.com/Programming/Q_21812622.html you can see I have posted a similar question but the difference was only the last character... Just modify that vbs script... I wish I know to program !... Now I have no free time but in future I will learn VB ! Thanks.
asgarcymedAsked:
Who is Participating?
 
vinnyd79Commented:
Change this line:

    baseName = Left(file.Name, Len(file.Name) - 5)

to:

    baseName = Left(file.Name, Len(file.Name) - 6)
0
 
asgarcymedAuthor Commented:
*) It is always two characters that are different at the end of the filenames;
*) The common part of the names is variable (not always 4 as I used in the example);
*) All the files are in the same folder at the same level (no recurse into subfolders needed);
*) I want the new sub directory in the same folder as the file.
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Lol...

Study the code asgarcymed.  Now is a great time to start learning!

You can find documentation on the language here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/ddfa5183-d458-41bc-a489-070296ced968.asp

And documention for the File System Object classes here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/057b68c9-6172-4f02-a6f3-12d85d16ac6a.asp
0
 
asgarcymedAuthor Commented:
vinnyd79 - That's it, thank you a lot !
0
 
asgarcymedAuthor Commented:
Idle_Mind  - thank your for the advices and links !
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.