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 file to Sort and Move specific files by identifying word inside

01 Oct 2014   #1
val5662

Windows 7 ultimate 32bit
 
 
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 on to the next one.If the word "body" is not found just close hex editor and ignore the file.
I have approx 900 files in a folder.One is a vehicle and one is a map for a game.They are mixed together and the only way of telling them apart is by opening each one with my hex editor and search for the word "body",which means it is a vehicle.If the "body" word is not found,it is a map.Example wording of the files: mapname.idf carname.idf
Manually this process would take hours,even days.
It would be a lot better if there is a way of doing this without using the hex editor/batch idea.
Here is a link to one map and one vehicle file if needed for an example:
http://vnovak.com/1nsane/2idf-files.zip
Thanks a bunch for your help!
Val


My System SpecsSystem Spec
.
01 Oct 2014   #2
Kaktussoft

Microsoft Community Contributor Award Recipient

Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
 
 

All files are in 1 folder now? If so tell me the folder name plz.
My System SpecsSystem Spec
01 Oct 2014   #3
val5662

Windows 7 ultimate 32bit
 
 

insanefiles
My System SpecsSystem Spec
.

02 Oct 2014   #4
Kaktussoft

Microsoft Community Contributor Award Recipient

Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
 
 

Quote   Quote: Originally Posted by val5662 View Post
insanefiles
so you want to move all files in folder "insanefiles" (not it's subfolders!) which has text "body" inside. Correct?
To which folder do you want to move them?
Please post complete source folder and destination folder. Then I can make a batch file
My System SpecsSystem Spec
02 Oct 2014   #5
val5662

Windows 7 ultimate 32bit
 
 

Insanefiles folder has 900 dot idf ( .idf ) extension files with naturally a different prefix on each.Example > anyname1.idf and anyname2.idf
If opened with a hex editor and search for the word body , only the vehicle idf has that word inside that idf file.
I want a batch file I can place inside the insanefiles folder that can be run and detect the body word inside the idf files,then move all those idf files into a folder inside the insanefiles folder named moved.The idf files that did not have the body word inside would be left alone,because a map idf file does not have the word body inside the idf file.
Thanks!
Val
My System SpecsSystem Spec
02 Oct 2014   #6
Kaktussoft

Microsoft Community Contributor Award Recipient

Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
 
 

This has be done once? Or should it be a perfect batch script?
My System SpecsSystem Spec
02 Oct 2014   #7
Kaktussoft

Microsoft Community Contributor Award Recipient

Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
 
 

Step 1: Create the folder called moved as subfolder.
Step 2: Open notepad and paste this code inside:
Code:
@echo off
for /f %%i in ('findstr /i /m "body" *.idf') do echo move "%%i" moved
pause
Save it and call the file movebody.cmd. Put the file in same folder as the *.idf files.
Step 3: Doubleclick on movebody.cmd. You see something like:
move somefile.idf moved
move someotherfile.idf moved
???
somefile.idf and someotherfile.idf are the correct files to move?
Remove the word "echo" inside the cmd file and run it again. Files are indeed moved? Run it again.... no files moved?
My System SpecsSystem Spec
02 Oct 2014   #8
val5662

Windows 7 ultimate 32bit
 
 

Thanks....I had to modify it like below and it worked but now I have a new problem.
A lot of these idf files have the word body with caps like Body or BODY and the code below just ignores those files.
How can I modify this code to make it NOT case sensitive?
Thanks again!

@echo off
md moved
for /f "eol=: delims=" %%F in ('findstr /m body *.idf') do @move "%%F" moved >nul
pause
My System SpecsSystem Spec
02 Oct 2014   #9
Tookeri

Windows 7 Pro 32
 
 

Excuse me for jumping in but I noticed Kaktussoft was offline.

Add /i to the findstr command. So your example above would change to:

('findstr /m /i body *.idf')
My System SpecsSystem Spec
02 Oct 2014   #10
val5662

Windows 7 ultimate 32bit
 
 

Thanks Tookeri........

That worked liked a charm!
I appreciate it,both of you guys!

Val
My System SpecsSystem Spec
Reply

 Batch file to Sort and Move specific files by identifying word inside




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
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
[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
Sort and Move Files by Size
What I want to do is go through about 2.5 TB of video files and eliminate all files (within folders) that are not video files. That means of course that I want to be able to sort, and move to a separate hdd, all files that are below a certain size, i.e. too small to be a video file. Now I do...
Performance & Maintenance
DOS Batch - Forfiles - deleting specific file extensions
Hey all. I've reviewed several different examples of how forfiles works. To set the stage, I need to automatically remove files with a file extension of .0 followed by numbers that increment and these files would be 7 days or older. Unfortunately, none of the examples or forfiles /? usage...
Customization
Help with Batch file, if statement in a specific time.
hi, I am working on a batch file, such as If this is not possible, then just simply, Thanks!
General Discussion
How to create a batch file that will move files based on the file type
How to create a batch file that will move files based on the file type? My Requirement : I need a batch file to copy all .doc files in all my HardDisk to a removable disk say (Z: drive) . Can anyone make it possible using a batch file?Please...Its urgent...
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 03:48.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App