Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Batch File (.bat) Coding

    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

  • #2
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    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.

  • Users who have thanked tomws for this post:

    Rob.K (07-30-2008)

  • #3
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •