Need A Batch File Arranger


Steve-O

Well-Known Member
Joined
Aug 28, 2003
Messages
4,054
Ok, I have 700 odd games for my Mobile phone and I was wondering if someone could code me or let me know a code that I could put in a text file and make a BAT file which can create folders, eg "0, A, B, C....... Z" and put each file into its own folder eg "KingKong.Jar" would go into folder "K" etc etc

Thanks :D
 
Steve-O posted on May 7 2006 at 08:55 PM said:
Ok, I have 700 odd games for my Mobile phone and I was wondering if someone could code me or let me know a code that I could put in a text file and make a BAT file which can create folders, eg "0, A, B, C....... Z" and put each file into its own folder eg "KingKong.Jar" would go into folder "K" etc etc

Thanks :D
If my friend Shaun was online then I could help you.
 
Last edited by a moderator:
Im just going to have a quick fiddle around for now and see If I can do it...

Ok, Started off :D

Code:
IF NOT EXIST DUMMY mkdir 0
IF NOT EXIST DUMMY mkdir A
IF NOT EXIST DUMMY mkdir B
IF NOT EXIST DUMMY mkdir C
IF NOT EXIST DUMMY mkdir D
IF NOT EXIST DUMMY mkdir E
IF NOT EXIST DUMMY mkdir F
IF NOT EXIST DUMMY mkdir G
IF NOT EXIST DUMMY mkdir H
IF NOT EXIST DUMMY mkdir I
IF NOT EXIST DUMMY mkdir J
IF NOT EXIST DUMMY mkdir K
IF NOT EXIST DUMMY mkdir L
IF NOT EXIST DUMMY mkdir M
IF NOT EXIST DUMMY mkdir N
IF NOT EXIST DUMMY mkdir O
IF NOT EXIST DUMMY mkdir P
IF NOT EXIST DUMMY mkdir Q
IF NOT EXIST DUMMY mkdir R
IF NOT EXIST DUMMY mkdir S
IF NOT EXIST DUMMY mkdir T
IF NOT EXIST DUMMY mkdir U
IF NOT EXIST DUMMY mkdir V
IF NOT EXIST DUMMY mkdir W
IF NOT EXIST DUMMY mkdir X
IF NOT EXIST DUMMY mkdir Y
IF NOT EXIST DUMMY mkdir Z


now to work out how to arrange them into the folders hhhmmmmmmm


OMG I DONE IT!!!!!! :D THIS IS THE GREATEST FEELING IN THE WORLD!!! LOL !!!!

I used

copy 7* 0

and it copied all files that started in 7 to folder 0 :D :D

now to complete my work and post the final code for everyone to use :) :D
 
Steve-O posted on May 7 2006 at 09:23 PM said:
Im just going to have a quick fiddle around for now and see If I can do it...

Ok, Started off :D

Code:
IF NOT EXIST DUMMY mkdir 0
IF NOT EXIST DUMMY mkdir A
IF NOT EXIST DUMMY mkdir B
IF NOT EXIST DUMMY mkdir C
IF NOT EXIST DUMMY mkdir D
IF NOT EXIST DUMMY mkdir E
IF NOT EXIST DUMMY mkdir F
IF NOT EXIST DUMMY mkdir G
IF NOT EXIST DUMMY mkdir H
IF NOT EXIST DUMMY mkdir I
IF NOT EXIST DUMMY mkdir J
IF NOT EXIST DUMMY mkdir K
IF NOT EXIST DUMMY mkdir L
IF NOT EXIST DUMMY mkdir M
IF NOT EXIST DUMMY mkdir N
IF NOT EXIST DUMMY mkdir O
IF NOT EXIST DUMMY mkdir P
IF NOT EXIST DUMMY mkdir Q
IF NOT EXIST DUMMY mkdir R
IF NOT EXIST DUMMY mkdir S
IF NOT EXIST DUMMY mkdir T
IF NOT EXIST DUMMY mkdir U
IF NOT EXIST DUMMY mkdir V
IF NOT EXIST DUMMY mkdir W
IF NOT EXIST DUMMY mkdir X
IF NOT EXIST DUMMY mkdir Y
IF NOT EXIST DUMMY mkdir Z


now to work out how to arrange them into the folders hhhmmmmmmm


OMG I DONE IT!!!!!! :D THIS IS THE GREATEST FEELING IN THE WORLD!!! LOL !!!!

I used

copy 7* 0

and it copied all files that started in 7 to folder 0 :D :D

now to complete my work and post the final code for everyone to use :) :D
Of Course!!!
 
Last edited by a moderator:
Code:
IF NOT EXIST DUMMY mkdir 0
IF NOT EXIST DUMMY mkdir 1
IF NOT EXIST DUMMY mkdir 2
IF NOT EXIST DUMMY mkdir 3
IF NOT EXIST DUMMY mkdir 4
IF NOT EXIST DUMMY mkdir 5
IF NOT EXIST DUMMY mkdir 6
IF NOT EXIST DUMMY mkdir 7
IF NOT EXIST DUMMY mkdir 8
IF NOT EXIST DUMMY mkdir 9
IF NOT EXIST DUMMY mkdir A
IF NOT EXIST DUMMY mkdir B
IF NOT EXIST DUMMY mkdir C
IF NOT EXIST DUMMY mkdir D
IF NOT EXIST DUMMY mkdir E
IF NOT EXIST DUMMY mkdir F
IF NOT EXIST DUMMY mkdir G
IF NOT EXIST DUMMY mkdir H
IF NOT EXIST DUMMY mkdir I
IF NOT EXIST DUMMY mkdir J
IF NOT EXIST DUMMY mkdir K
IF NOT EXIST DUMMY mkdir L
IF NOT EXIST DUMMY mkdir M
IF NOT EXIST DUMMY mkdir N
IF NOT EXIST DUMMY mkdir O
IF NOT EXIST DUMMY mkdir P
IF NOT EXIST DUMMY mkdir Q
IF NOT EXIST DUMMY mkdir R
IF NOT EXIST DUMMY mkdir S
IF NOT EXIST DUMMY mkdir T
IF NOT EXIST DUMMY mkdir U
IF NOT EXIST DUMMY mkdir V
IF NOT EXIST DUMMY mkdir W
IF NOT EXIST DUMMY mkdir X
IF NOT EXIST DUMMY mkdir Y
IF NOT EXIST DUMMY mkdir Z

COPY 0* 0
COPY 1* 1
COPY 2* 2
COPY 3* 3
COPY 4* 4
COPY 5* 5
COPY 6* 6
COPY 7* 7
COPY 8* 8
COPY 9* 9
COPY a* a
COPY b* b
COPY c* c
COPY d* d
COPY e* e
COPY f* f
COPY g* g
COPY h* h
COPY i* i
COPY j* j
COPY k* k
COPY l* l
COPY m* m
COPY n* n
COPY o* o
COPY p* p
COPY q* q
COPY r* r
COPY s* s
COPY t* t
COPY u* u
COPY v* v
COPY w* w
COPY x* x
COPY y* y
COPY z* z


:D :D :D :D
 
hehe

going to try and add more features to mine, seems a good way to learn how to do things :)

originally wanted files 1 - 9 to goto one folder but then I counted up how many their was and decided to put them in their own :)
 
Steve-O posted on May 7 2006 at 10:10 PM said:
hehe

going to try and add more features to mine, seems a good way to learn how to do things :)

originally wanted files 1 - 9 to goto one folder but then I counted up how many their was and decided to put them in their own :)
I jsut made mine delete everything as well. It deletes all letters but O and then deletes itself lol. It archives itself first. Should stop it deleting itself I suppose but Im tired lol
 
Last edited by a moderator:
Because I could.
Code:
@echo off
verify other 2>nul
setlocal enableextensions
if errorlevel 1 (
  echo Unable to enable command extensions
  goto end
)
if "%1" == "" (
  echo Syntax: %~nx0 ^<source folder^>
  goto end
)
pushd %1
for %%I in (*) do (
  set NAME=%%~nI
  set TARGET=%~dp0sorted\!NAME:~0,1!
  if not exist !TARGET! mkdir !TARGET!
  echo Moving %%I to !TARGET!
  move %%I !TARGET!
)
popd
:end
endlocal
 
Back
Top