Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


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

27 Sep 2011   #1
santasnotreal

Windows 7 Professional x64
 
 
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 System SpecsSystem Spec
.

28 Sep 2011   #2
CreepinJesus

Windows 7 Ultimate x64
 
 

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 System SpecsSystem Spec
Reply

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




Thread Tools





Similar help and support threads
Thread Forum
Folder read only and want all files placed in to become auto read only
Creating a new Folder as read only and would like to have all files placed into that new Folder become read only as they are added or moved into that read only Folder. If Windows 7 cannot handle this is there any kind of software utility Haddon I can get to perform this task?
General Discussion
Batch file to Sort and Move specific files by identifying word inside
Hi All... I will explain what I need in as much detail as possible. I need a batch file to move specific files into a separate folder,possibly by opening my hex editor,searching for the word "body" ( without the quotes ) and if found ,close hex editor,move file to a folder called "moved" ,then go...
General Discussion
[Help] Batch File move every 15.000 files to another folders
Hi guys I'm new here, please help I have about 2 million email files that i want to convert into mbox files. but the tool i used only can convert every 15.000 files. so i need a batch file that can move this 2 million files into another folder (15.000 files each folder) and the folder name...
General Discussion
Batch File to Move a list of files.
Hey All, I just joined this forum to find some help on a specific topic that I've been researching for like two hours now on google. I have a list of 1300 files that I need to move from one location to another (move not copy). I've found this batch file created by Neutron16 which performs a Move...
General Discussion
Trying to use batch code to parse and archive log files... Errors...
Hi all. I have a quick question about compressing a bunch of log files that have specific years at the end of their file names... Let's say I have the following set of files needing to be archived by year: BVC2v2Batch.01042008.log BVC2v2Batch.02042008.log BVC2v2Batch.01042009.log...
Software
Batch file to move (many) duplicted folder contents - Help!!
Hope I can explain my difficulty. I have duplicated folders album name for all my music files. As there is quite a considerable number I wondered if it was possible to batch file (automate) the process. I can not delete "d" as this would delete all the tracks. What I need to do is move the...
General Discussion

Our Sites

Site Links

About Us

Find 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 16:38.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App