...

View Full Version : Batch File (.bat) Coding



Rob.K
07-30-2008, 12:36 PM
Hi,

I have basic knowledge of .bat files and need some advice on how to code something. I need a .bat (or equivalent) to move files into a specific folders based on the files name.

For example.

Original folder (which is the source of retrieval) contains:
Hello_01.doc
Hello_02.doc
Goodbye_01.doc
Goodbye_02.doc

Sub-folders are:
/Hello
/Goodbye

So the .bat needs to run on the original folder. It needs to recognise the first word of in the filename and then move the file into the corresponding folder leaving the original file empty. Also the filename needs to remain the same as it was originally.

If anyone can help me with this it would be much appreciated.

Thanks,

Rob

tomws
07-30-2008, 03:15 PM
Batch files are quite limited in their capabilities, and this sounds like one instance where they won't help. You might rather try searching for 'Windows shell scripting' or, perhaps better, install Windows Power Shell straight from MS and start learning that. Off the top of my head, this sounds like a use for regular expressions and old-school DOS batch files won't be very helpful.

Rob.K
07-30-2008, 04:24 PM
I was only aware of the basic functions of batch files, I was kinda hoping no one would tell me this.
I'll look into the windows shell scripting but if you or anyone else figures another easy way please let me know.
Anything to carry out this type of operation will do.

Thanks,

Rob



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum