Computing.Net > Forums > Disk Operating System > Move mass files

Move mass files

Reply to Message Icon

Original Message
Name: bdbden
Date: April 3, 2003 at 16:13:42 Pacific
Subject: Move mass files
OS: winME
CPU/Ram: 2.0ghz/512mg
Comment:

Is there a way to do this In Win ME or a DOS batch.

I wish to move many files from one dir to other dirs. With the result that each new dir is auto named and has a max number of files.

Like This

c:\abc\ with 1,830 files

to be moved with this result.

c:\def\001\ 100 files
c:\def\002\ 100 files
c:\def\003\ 100 files
c:\def\004\ 100 files
etc.....
the last having only 30 files
the only sorting variable would be alpha, # and extension not a factor.

Thank you


Report Offensive Message For Removal


Response Number 1
Name: Secret_Doom
Date: April 5, 2003 at 20:37:20 Pacific
Reply: (edit)

You don't mean to include the files on subdirectories from the source directory (c:\abc) on that moving process, do you?

About that sorting, where you mentioned alpha but not numeric nor extentions being a factor, I presume you mean the list of files to be moved, in the proper order, would be outputed by the following command:

dir /a-d /b /on

Really check it, the batch script I developed is based on that very list, so if it's not the order you intend, the script won't fit your needs.

If everything I said so far is correct - no subdirs from source involved and sorting method correcly understood - I've got a solution for you - a batch script. Cut-paste the following code to a text file and save it with a .bat extention, make the necessary changes (read comment lines) and run it:

@echo off
if "%1"=="GoTo" goto %2

:: Set source and destination directories below
set SRC=C:\ABC
set DEST=C:\DEF

echo e100 BE 00 00 86 06 74 01 86 06 75 01 BA 74 01 B9 01> %temp%.\t1.com
echo e110 00 BB 00 00 B4 3F CD 21 09 C0 74 46 B9 01 00 80>> %temp%.\t1.com
echo e120 3E 75 01 0A 75 33 46 83 FE 66 75 27 BE 01 00 FE>> %temp%.\t1.com
echo e130 06 6A 01 80 3E 6A 01 3A 75 19 C6 06 6A 01 30 FE>> %temp%.\t1.com
echo e140 06 69 01 80 3E 69 01 3A 75 09 C6 06 69 01 30 FE>> %temp%.\t1.com
echo e150 06 68 01 BA 64 01 B9 11 00 BB 01 00 B4 40 CD 21>> %temp%.\t1.com
echo e160 EB A1 CD 20 25 50 25 20 30 30 31 0D 0A 53 45 54>> %temp%.\t1.com
echo e170 20 25 31 3D 0A 00>> %temp%.\t1.com
for %%? in (rcx 76 w q) do echo %%?>> %temp%.\t1.com
type %temp%.\t1.com |DEBUG %temp%.\t1.com > nul
set dircm_=%dircmd%
set dircmd=
dir /a-d /b /on "%SRC%\*.*" > %temp%.\t2.dat
set dircmd=%dircm_%
set dircm_=
echo.>> %temp%.\t2.dat
%temp%.\t1.com < %temp%.\t2.dat > %temp%.\t3.bat
set P=call %0 GoTo process
call %temp%.\t3.bat FILE
for %%? in (t1.com t2.dat t3.bat) do del %temp%.\%%?
goto eof
:process
if not exist "%DEST%.\%1\nul" md "%DEST%.\%1"

:: To activate the script, remove "echo.{demo}" from next line
echo.{demo}move "%SRC%.\%FILE%" "%DEST%.\%1"

:eof

That script is de-activated. If you run it like that, it will just display the actions it would take if active. If those are the desired actions, activate the script (read comment lines for doing so).

That script has been developed and tested under Windows 98 SE. I don't know if it will work on Windows ME properly. However, both environmets are very close, so there shouldn't be any problems. Besides, most of the script is actually assembler (embed code), which should reduce the incompatibility chance.

-- Leonardo Pignataro - Secret_Doom --

secret_doom@hotmail.com
www.batch.hpg.com.br

___________________________________________________________________________


Report Offensive Follow Up For Removal

Response Number 2
Name: Secret_Doom
Date: April 5, 2003 at 20:52:06 Pacific
Reply: (edit)

Oooops, bug found! Ignore script from last post, use this one instead:

@echo off
if "%1"=="GoTo" goto %2

:: Set source and destination directories below
set SRC=C:\ABC
set DEST=C:\DEF

echo e100 BE 00 00 86 06 74 01 86 06 75 01 BA 74 01 B9 01> %temp%.\t1.com
echo e110 00 BB 00 00 B4 3F CD 21 09 C0 74 46 B9 01 00 80>> %temp%.\t1.com
echo e120 3E 75 01 0A 75 33 46 83 FE 66 75 27 BE 01 00 FE>> %temp%.\t1.com
echo e130 06 6A 01 80 3E 6A 01 3A 75 19 C6 06 6A 01 30 FE>> %temp%.\t1.com
echo e140 06 69 01 80 3E 69 01 3A 75 09 C6 06 69 01 30 FE>> %temp%.\t1.com
echo e150 06 68 01 BA 64 01 B9 11 00 BB 01 00 B4 40 CD 21>> %temp%.\t1.com
echo e160 EB A1 CD 20 25 50 25 20 30 30 31 0D 0A 53 45 54>> %temp%.\t1.com
echo e170 20 25 31 3D 0A 00>> %temp%.\t1.com
for %%? in (rcx 76 w q) do echo %%?>> %temp%.\t1.com
type %temp%.\t1.com |DEBUG %temp%.\t1.com > nul
set dircm_=%dircmd%
set dircmd=
dir /a-d /b /on "%SRC%\*.*" > %temp%.\t2.dat
set dircmd=%dircm_%
set dircm_=
echo.>> %temp%.\t2.dat
%temp%.\t1.com < %temp%.\t2.dat > %temp%.\t3.bat
set P=call %0 GoTo process
call %temp%.\t3.bat FILE
for %%? in (t1.com t2.dat t3.bat) do del %temp%.\%%?
goto eof
:process
if not exist "%DEST%.\%3\nul" md "%DEST%.\%3"

:: To activate the script, remove "echo.{demo}" from next line
echo.{demo}move "%SRC%.\%FILE%" "%DEST%.\%3"

:eof

Sorry about that. BTW, the script may seem wierd because of the embed asm code, but it does work (at least on Win98SE).

-- Leonardo Pignataro - Secret_Doom --

secret_doom@hotmail.com
www.batch.hpg.com.br

___________________________________________________________________________


Report Offensive Follow Up For Removal

Response Number 3
Name: bdbden
Date: April 5, 2003 at 22:55:54 Pacific
Reply: (edit)

Thank You so much!!
The Demo ran perfectly.
The real test was flawless, exactly what I needed. You prove that a PC can be programmed to wake up the chickens. Or stop the tap from dripping in the sink. the bat file ran in
WIN ME perfectly.
You are awesome.
Thanks again

bdbden
ddennis@iadfw.net


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Move mass files

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge