Hi, im new here and please excuse my horrible english, but I need help with VBscripting.
The VBS schould get the size of a folder, the folder name is given
and consists of a number and a keyword.
Now the script should look if there are any other folder in the
directorey with the same keyword in its name, but an other mumber.
if the found folder is smaller then delete it if not then give out an error.
for example:
folder1: 123test 56GB
folder2: 754test 54GB
123 is the number and test is the keyword and the number and the keyword should be given as arguments to the vb script.
Usually I did this with a Batch file that i wrote but know i have the problem that the size of the folder and the files in that folder are bigger than 2 GB and Batch can only handle 32 Bit #.
My script:
@echo off
setlocal enabledelayedexpansion
set size = 0
set key=test
set date=212
if exist *%key%\. for /d %%x in (*%key%) do (if not %%x==%date%%key% set oldf=%%x & goto testen)
goto end
:testen
for /R %oldf% %%F in (*) do (
set /a value=%%~zF
set /a oldsize=!oldsize!+!value!
)
for /R %date%%key% %%F in (*) do (
set /a value=%%~zF
set /a newsize=!newsize!+!value!
)
if %newsize% GTR %oldsize% echo del %oldf%
if %oldsize% GTR %newsize% echo needs checking
:end
endlocal
Thanks for helping
The VBS schould get the size of a folder, the folder name is given
and consists of a number and a keyword.
Now the script should look if there are any other folder in the
directorey with the same keyword in its name, but an other mumber.
if the found folder is smaller then delete it if not then give out an error.
for example:
folder1: 123test 56GB
folder2: 754test 54GB
123 is the number and test is the keyword and the number and the keyword should be given as arguments to the vb script.
Usually I did this with a Batch file that i wrote but know i have the problem that the size of the folder and the files in that folder are bigger than 2 GB and Batch can only handle 32 Bit #.
My script:
@echo off
setlocal enabledelayedexpansion
set size = 0
set key=test
set date=212
if exist *%key%\. for /d %%x in (*%key%) do (if not %%x==%date%%key% set oldf=%%x & goto testen)
goto end
:testen
for /R %oldf% %%F in (*) do (
set /a value=%%~zF
set /a oldsize=!oldsize!+!value!
)
for /R %date%%key% %%F in (*) do (
set /a value=%%~zF
set /a newsize=!newsize!+!value!
)
if %newsize% GTR %oldsize% echo del %oldf%
if %oldsize% GTR %newsize% echo needs checking
:end
endlocal
Thanks for helping