Batch code to read, then move files from one folder to another


  1. Posts : 1
    Windows 7 Professional x64
       #1

    Batch code to read, then move files from one folder to another


    I'm new to batch coding, so I was hoping someone could help me out. I need to read several .txt files and search them for a specific string, lets say "key1" and "key2." If the file has key1, then it needs to be moved into directory1. If the file has key2, then it needs to be moved to directory2. There's no telling ahead of time what line the string is going to be on, so I'm guessing I could use "Find" to search for the key? Then how do I loop through all the files, read them, then sort them into the different directories?
    Any help is much appreciated!
      My Computer


  2. Posts : 370
    Windows 7 Ultimate x64
       #2

    I think that might be easier to do with a PowerShell script, though I'm no help on either of these subjects, I'm afraid.

    Have a quick Google/Bing around for PowerShell scripting - I wouldn't imagine this is very difficult for beginners (the scripting, not Googling )
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 05:20.
Find Us