1.

Solve : Batch file needed... Totally bamboozled :)?

Answer»

Hi i am a new user here and im hoping that someone here can accomplish what ive been trying to do for the last hour!!

Hope this is in the right forum too.....

I have a folder full of GAMES with trainers. I want to move all of the trainers to separate folders named after the game that they are for.

Example:

G:\Games\Game 1\game file1
G:\Games\Game 1\game file2
G:\Games\Game 1\game file3
G:\Games\Game 1\game file4
G:\Games\Game 1\trainer.exe
G:\Games\Game 1\trainerdata.exe

I want to move the 2 files with trainer in the filename to a folder called "Game 1"

I would like to be able to run the script in the G:\Games folder and have it search all the subfolders for any files with trainer in the filename and move them to a named after that particular game in G:\Trainers

So GOING on the above it would look like this after running the script

G:\Games\Game 1\game file1
G:\Games\Game 1\game file2
G:\Games\Game 1\game file3
G:\Games\Game 1\game file4

and there would now be

G:\Trainers\Game 1\trainer.exe
G:\Trainers\Game 1\trainerdata.exe


I hope ive explained it well enough, and i really hope someone can help me out with this its been driving me mental!!!!What have you done so far?
Nothing that works at all Even that will help us
I dont have anything i can SHOW you im afraid, i deleted all my efforts as none of them worked at all.
I had basically been googling for various scripts and trying to butcher them and come up with something that worked.I feel generous - but this MAY nuke Windows. You've been warned.

Code: [Select]@echo off
for /r "g:\games" %%a in (*trainer*.exe) do (
for %%b in ("%%~dpa\.") do md "g:\trainer\%%~nxb" 2>nul & move "%%a" "g:\trainer\%%~nxb" >nul & echo "%%a"
)
pause
Excellent, thanks foxidrive!!!

I hope i dont get nuked as im gonna test it now

Edit: Did the job PERFECTLY, thanks again foxidrive



Discussion

No Comment Found