autozip.bat

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Jumpman
Posts: 5
Joined: 25 Oct 2011 11:15

autozip.bat

#1 Post by Jumpman » 01 Nov 2011 08:10

Hi

I have som demo files from our counter-strike server i want to zip before uploading them to our webhotel so our members can download them

my code i use from other site just with my settings look like this.

Code: Select all

@setlocal
@echo off
set path="D:\Programmer\WinRAR\";%path%
FOR %%A IN (%DATE:/=%) DO SET Today=%%A
winrar.exe a -afzip -m5 -ed -r E:\Dokumenter\Office\Server\autodemos\demos\gungameII\%TODAY%.zip E:\Dokumenter\Office\Server\autodemos\demos\gungameII\*.*
After i rund the batch job i have one large file name if today 01-11-2011.zip

But i really want to have them zip separate instead ex. map1.zip map2.zip map3.zip etc. how do i do that ?

I use this bat to download our files every day viewtopic.php?f=3&t=2373 problem is it download all files not only the new as it should do.

Ps. I do not know anything about programming but I'm trying to learn hope someone can help :-)

trebor68
Posts: 146
Joined: 01 Jul 2011 08:47

Re: autozip.bat

#2 Post by trebor68 » 01 Nov 2011 11:24

I have search in the WWW and found a parameter list.

I think you need one of the following options:
ta<date> Process files modified after <date> in YYYYMMDDHHMMSS format
tb<date> Process files modified before <date> in YYYYMMDDHHMMSS format

Jumpman
Posts: 5
Joined: 25 Oct 2011 11:15

Re: autozip.bat

#3 Post by Jumpman » 06 Nov 2011 05:24

Thanks, but it was separated zip files i needed from every map i have on our server.

I fix it with this every thing work now.

Code: Select all

set _folder_in_ffa="E:\Dokumenter\Office\Server\autodemos\demos\ffa\"
set _folder_out_ffa="E:\Dokumenter\Office\Server\autodemos\demos\ffa\"
set _folder_in_gg1="E:\Dokumenter\Office\Server\autodemos\demos\gungameI\"
set _folder_out_gg1="E:\Dokumenter\Office\Server\autodemos\demos\gungameI\"
set _folder_in_gg2="E:\Dokumenter\Office\Server\autodemos\demos\gungameII\"
set _folder_out_gg2="E:\Dokumenter\Office\Server\autodemos\demos\gungameII\"
for /r %_folder_in_ffa% %%g in (*.dem) do call :process_ffa "%%g"
for /r %_folder_in_gg1% %%g in (*.dem) do call :process_gg1 "%%g"
for /r %_folder_in_gg2% %%g in (*.dem) do call :process_gg2 "%%g"
goto :eof

:process_ffa
set _file=%~n1
set _ext=%~x1
set _fullfile=%~f1
D:\Programmer\WinRAR\winrar.exe a -afzip "%_folder_out_ffa%%_file%.zip" "%_fullfile%"
goto :eof

:process_gg1
set _file=%~n1
set _ext=%~x1
set _fullfile=%~f1
D:\Programmer\WinRAR\winrar.exe a -afzip "%_folder_out_gg1%%_file%.zip" "%_fullfile%"
goto :eof

:process_gg2
set _file=%~n1
set _ext=%~x1
set _fullfile=%~f1
D:\Programmer\WinRAR\winrar.exe a -afzip "%_folder_out_gg2%%_file%.zip" "%_fullfile%"
goto :eof

Post Reply