Pegasus (MVP) said:
You could run the batch file below to create a number of
folders, each containing a batch of files that would fit on a
single CD. Test the batch file as it is. When satisfied, remove
the word "echo" from lines 42 and 43 to activate it.
Line01 @echo off
Line02 set limit=700000000
Line03 set source=c:\Documents and Settings\Broons\My Music
Line04
Line05 rem Do not change anything below this line!
Line06 set time_=%time:~0,8%
Line07 set TargetFolder=c:\%time_::=%
Line08 set batch=1
Line09
Line10 setlocal enabledelayedexpansion
Line11
Line12 dir "%source%" /on /a-d /-c | find "/" > c:\folder.txt
Line13
Line14 set s=0
Line15 set sum=0
Line16 if exist c:\files.txt del c:\files.txt
Line17
Line18 for /F "tokens=1-3*" %%a in (c:\folder.txt) do (
Line19 set /a s=!sum! + %%c
Line20 if !s! GTR %limit% (
Line21 call :Assemble !sum!
Line22 set s=%%c
Line23 del c:\files.txt
Line24 )
Line25 set sum=!s!
Line26 echo %%d>> c:\files.txt
Line27 )
Line28
Line29 call :Assemble
Line30 del c:\files.txt & del c:\folder.txt
Line31 echo.
Line32 echo Your files are ready to burn in %TargetFolder%.
Line33 echo.
Line34 pause
Line35 endlocal
Line36 goto :eof
Line37 -----------------------------------------
Line38
Line39 :Assemble
Line40
Line41 set Target=%TargetFolder%\%batch%
Line42 echo md "%Target%"
Line43 for /F "tokens=*" %%* in (c:\files.txt) do echo move "%source%\%%*"
"%Target%"
Line44 echo Batch # %batch% is stored in %Target%. Size=%sum% bytes
Line45 echo.
Line46 pause
Line47 set /a batch=%batch% + 1
thanks for this I get a lot of error messages of the form:
'áááá' is not recognized as an internal or external command,
operable program or batch file.
'áááá' is not recognized as an internal or external command,
operable program or batch file.
'áááá' is not recognized as an internal or external command,
operable program or batch file.
'á' is not recognized as an internal or external command,
operable program or batch file.
'á' is not recognized as an internal or external command,
operable program or batch file.
Here is my file
@echo off
set limit=700000000
set source=C:\Documents and Settings\User\My Documents\Table Tennis
rem Do not change anything below this line!
set time_=%time:~0,8%
set TargetFolder=c:\%time_::=%
set batch=1
setlocal enabledelayedexpansion
dir "%source%" /on /a-d /-c | find "/" > c:\folder.txt
set s=0
set sum=0
if exist c:\files.txt del c:\files.txt
for /F "tokens=1-3*" %%a in (c:\folder.txt) do (
set /a s=!sum! + %%c
if !s! GTR %limit% (
call :Assemble !sum!
set s=%%c
del c:\files.txt
)
set sum=!s!
echo %%d>> c:\files.txt
)
call :Assemble
del c:\files.txt & del c:\folder.txt
echo.
echo Your files are ready to burn in %TargetFolder%.
echo.
pause
endlocal
goto :eof
-----------------------------------------
:Assemble
set Target=%TargetFolder%\%batch%
echo md "%Target%"
for /F "tokens=*" %%* in (c:\files.txt) do echo move "%source%\%%*"
t%"
echo Batch # %batch% is stored in %Target%. Size=%sum% bytes
echo.
pause
set /a batch=%batch% + 1