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

val5662

New member
Local time
2:15 AM
Messages
10
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 Computer My Computer

Computer type
PC/Desktop
OS
Windows 7 ultimate 32bit
All files are in 1 folder now? If so tell me the folder name plz.
 

My Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
ACER ASPIRE 5742G
OS
Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
CPU
Intel(R) Core(TM) i3 CPU M 370 @ 2.40GHz
Motherboard
Acer Aspire 5742G
Memory
4,00 GB
Graphics Card(s)
ATI Mobility Radeon HD 5400 Series
Sound Card
(1) AMD High Definition Audio Device (2) Realtek High Defi
Screen Resolution
1366 x 768 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
WDC WD5000BEVT-22ZAT0
insanefiles
 

My Computer My Computer

Computer type
PC/Desktop
OS
Windows 7 ultimate 32bit
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 Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
ACER ASPIRE 5742G
OS
Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
CPU
Intel(R) Core(TM) i3 CPU M 370 @ 2.40GHz
Motherboard
Acer Aspire 5742G
Memory
4,00 GB
Graphics Card(s)
ATI Mobility Radeon HD 5400 Series
Sound Card
(1) AMD High Definition Audio Device (2) Realtek High Defi
Screen Resolution
1366 x 768 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
WDC WD5000BEVT-22ZAT0
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 Computer My Computer

Computer type
PC/Desktop
OS
Windows 7 ultimate 32bit
This has be done once? Or should it be a perfect batch script?
 

My Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
ACER ASPIRE 5742G
OS
Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
CPU
Intel(R) Core(TM) i3 CPU M 370 @ 2.40GHz
Motherboard
Acer Aspire 5742G
Memory
4,00 GB
Graphics Card(s)
ATI Mobility Radeon HD 5400 Series
Sound Card
(1) AMD High Definition Audio Device (2) Realtek High Defi
Screen Resolution
1366 x 768 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
WDC WD5000BEVT-22ZAT0
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?
 
Last edited:

My Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
ACER ASPIRE 5742G
OS
Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
CPU
Intel(R) Core(TM) i3 CPU M 370 @ 2.40GHz
Motherboard
Acer Aspire 5742G
Memory
4,00 GB
Graphics Card(s)
ATI Mobility Radeon HD 5400 Series
Sound Card
(1) AMD High Definition Audio Device (2) Realtek High Defi
Screen Resolution
1366 x 768 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
WDC WD5000BEVT-22ZAT0
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 Computer My Computer

Computer type
PC/Desktop
OS
Windows 7 ultimate 32bit
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 Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
HP Elitebook 8540p
OS
Windows 7 Pro 32
CPU
Intel(R) Core(TM) i5 CPU M 540 @ 2.53GHz
Motherboard
Hewlett-Packard 1521
Memory
4,00 GB (Usable 2,98)
Graphics Card(s)
NVIDIA NVS 5100M
Sound Card
NVIDIA High Definition Audio
Screen Resolution
1600x900
Hard Drives
INTEL SSDSA2CW120G3
Antivirus
F-Secure Internet Security
Browser
IE, Firefox, Opera
Other Info
Sandboxie,
SRP (Software Restriction Policy),
EMET (Enhanced Mitigation Experience Toolkit),
WFC (Windows Firewall Control by BiniSoft),
Malwarebytes Premium
Thanks Tookeri........

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

Val
 

My Computer My Computer

Computer type
PC/Desktop
OS
Windows 7 ultimate 32bit
Back
Top