gzip batch
Moderator: DosItHelp
gzip batch
Hello
i would to make a batch
to zip with gzip my (css, js, html) files which are into directories and subdirectories, i would also to conserve these files not zipped where they are
i would that
my zipped css files instead to be *.css.gz be *.csz
my zipped js files instead to be *.js.gz be *.jgz
my zipped html files instead to be *.html.gz be *.htz
is there someone who could help me for that
thanks a lot
http://gnuwin32.sourceforge.net/packages/gzip.htm
i would to make a batch
to zip with gzip my (css, js, html) files which are into directories and subdirectories, i would also to conserve these files not zipped where they are
i would that
my zipped css files instead to be *.css.gz be *.csz
my zipped js files instead to be *.js.gz be *.jgz
my zipped html files instead to be *.html.gz be *.htz
is there someone who could help me for that
thanks a lot
http://gnuwin32.sourceforge.net/packages/gzip.htm
-
- Posts: 208
- Joined: 26 Dec 2013 09:28
- Contact:
Re: gzip batch
Very simple
Code: Select all
@echo off
setlocal
set "ext_o=.gz"
if /i "%~x1" == ".css" set "ext_o=.csz"
if /i "%~x1" == ".js" set "ext_o=.jgz"
if /i "%~x1" == ".html" set "ext_o=.htz"
gzip -c "%~dpnx1" > "%~dpn1%ext_o%"
Last edited by siberia-man on 16 Apr 2019 14:08, edited 2 times in total.
Re: gzip batch
A great thanks for your help siberia-man
i have installed gzip for windows with the setup
and by example
root/yourbatch.bat
root/index.html
root/js.js
root/file.css
root/firstdir/page1.html
root/firstdir/page2.html
root/2dir/page3.html
root/2dir/page4.html
nothing append
what is wrong?
i have installed gzip for windows with the setup
and by example
root/yourbatch.bat
root/index.html
root/js.js
root/file.css
root/firstdir/page1.html
root/firstdir/page2.html
root/2dir/page3.html
root/2dir/page4.html
nothing append
what is wrong?
-
- Posts: 208
- Joined: 26 Dec 2013 09:28
- Contact:
Re: gzip batch
geronimo1,
I am so sorry that I have made some rude mistakes. I updated my previous post and fixed them. Please try again.
I am so sorry that I have made some rude mistakes. I updated my previous post and fixed them. Please try again.
Re: gzip batch
still thank siberian-man
now i just got
maximun level for st local was reached
nothing else happend
now i just got
maximun level for st local was reached
nothing else happend
-
- Posts: 208
- Joined: 26 Dec 2013 09:28
- Contact:
Re: gzip batch
I don't know and can't imagine what have you done. First of all, try to run the script with a single file check the result and go ahead with others.
Re: gzip batch
hello with a single html file in the same directory than your batch i just got
.gz o octet
on a cmd command line -r mean recursive, -k mean keep file
C:>"C:\Program Files (x86)\GnuWin32\bin\gzip.exe" -r -k D:\Documents\mydirectory
i keep all the files and get all the files zipped in all directories but its with a cmd command line and all files are zipped not only css js and html
with -f mean force to copy under files if they exist i have an error i think its because my directory is in reading only, and i cannot uncheck it
C:>"C:\Program Files (x86)\GnuWin32\bin\gzip.exe" -r -k -f D:\Documents\mydirectory
.gz o octet
on a cmd command line -r mean recursive, -k mean keep file
C:>"C:\Program Files (x86)\GnuWin32\bin\gzip.exe" -r -k D:\Documents\mydirectory
i keep all the files and get all the files zipped in all directories but its with a cmd command line and all files are zipped not only css js and html
with -f mean force to copy under files if they exist i have an error i think its because my directory is in reading only, and i cannot uncheck it
C:>"C:\Program Files (x86)\GnuWin32\bin\gzip.exe" -r -k -f D:\Documents\mydirectory
Re: gzip batch
maximun level for set local was reached
-
- Posts: 208
- Joined: 26 Dec 2013 09:28
- Contact:
Re: gzip batch
you do something not in right way. Please try with a single file and check your results.
Re: gzip batch
hello
thanks again to try to help me
so i am with windows10
in the same directory only your batch + index.html
result: message without interruption: "Le niveau maximal de recursivité de set local a été atteint"
so i stop
then
your batch, index.html, -c.gz, .gz
(the two files -c.gz and .gz are 0 octets)
thanks again to try to help me
so i am with windows10
in the same directory only your batch + index.html
result: message without interruption: "Le niveau maximal de recursivité de set local a été atteint"
so i stop
then
your batch, index.html, -c.gz, .gz
(the two files -c.gz and .gz are 0 octets)
Re: gzip batch
No problems using the script on my end.
Directory listing
Run the batch file on each file.
New Directory listing.
Directory listing
Code: Select all
C:\BatchFiles\GZIP>dir
Volume in drive C is 15_10P
Volume Serial Number is DE79-4A59
Directory of C:\BatchFiles\GZIP
04/18/2019 11:20 AM <DIR> .
04/18/2019 11:20 AM <DIR> ..
04/18/2019 11:18 AM 34 file.css
04/18/2019 11:19 AM 53 foobar.js
04/18/2019 11:13 AM 207 gz.bat
04/18/2019 11:17 AM 18 index.html
4 File(s) 312 bytes
2 Dir(s) 64,868,696,064 bytes free
Code: Select all
C:\BatchFiles\GZIP>gz.bat file.css
C:\BatchFiles\GZIP>gz.bat foobar.js
C:\BatchFiles\GZIP>gz.bat index.html
Code: Select all
C:\BatchFiles\GZIP>dir
Volume in drive C is 15_10P
Volume Serial Number is DE79-4A59
Directory of C:\BatchFiles\GZIP
04/18/2019 11:21 AM <DIR> .
04/18/2019 11:21 AM <DIR> ..
04/18/2019 11:18 AM 34 file.css
04/18/2019 11:21 AM 59 file.csz
04/18/2019 11:21 AM 69 foobar.jgz
04/18/2019 11:19 AM 53 foobar.js
04/18/2019 11:13 AM 207 gz.bat
04/18/2019 11:17 AM 18 index.html
04/18/2019 11:21 AM 43 index.htz
7 File(s) 483 bytes
2 Dir(s) 64,868,564,992 bytes free
C:\BatchFiles\GZIP>
Re: gzip batch
Code: Select all
Le volume dans le lecteur D n'a pas de nom.
Le num‚ro de s‚rie du volume est AED5-0530
R‚pertoire de D:\Documents\directory
19/04/2019 08:43 0 -c.gz
19/04/2019 08:43 0 .gz
16/04/2019 19:30 10˙167 file.css
19/04/2019 08:40 207 gzip.bat
19/04/2019 08:47 0 txt
5 fichier(s) 10˙374 octets
0 R‚p(s) 384˙245˙366˙784 octets libres
---------------------------------------------------
Le volume dans le lecteur D n'a pas de nom.
Le num‚ro de s‚rie du volume est AED5-0530
R‚pertoire de D:\Documents\directory
19/04/2019 08:49 0 -c.gz
19/04/2019 08:49 0 .gz
16/04/2019 19:30 10˙167 foobar.js
19/04/2019 08:40 207 gzip.bat
19/04/2019 08:49 0 txt.txt
5 fichier(s) 10˙374 octets
0 R‚p(s) 384˙245˙366˙784 octets libres
---------------------------------------------------
Le volume dans le lecteur D n'a pas de nom.
Le num‚ro de s‚rie du volume est AED5-0530
R‚pertoire de D:\Documents\directory
19/04/2019 08:40 207 gzip.bat
16/04/2019 19:30 10˙167 index.html
19/04/2019 08:50 0 txt.txt
3 fichier(s) 10˙374 octets
0 R‚p(s) 384˙245˙366˙784 octets libres
------------------------------------------
if i run your script fron c: its the same result
-
- Posts: 208
- Joined: 26 Dec 2013 09:28
- Contact:
Re: gzip batch
rename gzip.bat to gz.bat
Re: gzip batch
Would like to remind you that this is an English speaking forum and if you want help you need to translate everything to English.
Re: gzip batch
Come on Squashman. His explanation is in English. The French text is the quoted output of the DIR command. I suspect you don't need a translation for the header and footer
Steffen
Steffen