Hack Forums
[Shell] Shell Script Gzip - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Shell] Shell Script Gzip (/showthread.php?tid=5943245)



Shell Script Gzip - Z0Ra - Feb 20, 2019

Can anyone help me out with an assignment that involves compressing files using gzip? Done on bash. Message me or post below please.


RE: Shell Script Gzip - Unk0wn - Feb 20, 2019

(Feb 20, 2019 12:16 PM)Z0Ra Wrote:  Can anyone help me out with an assignment that involves compressing files using gzip? Done on bash. Message me or post below please.

Well I'm by far no expert but google is your best friend and using google I found this

Code
  rem Pick up each file in C:\Temp1\ with .out extension.
  for %%a in ("C:\temp1\*.out") do (

       rem Compress the file to a file with the same name but .gz extension is added.
       gzip -c %%a > %%a.gz

       rem Delete the .out file which has been already compressed.
       del /F /Q %%a
   )
I don't know if this helped that much or not but I hope it did  😁

Legit 2 seconds after this I saw you wanted bash not batch so i can't really help in that sense since I'm a noob when it comes to bash but found something that might help here


RE: Shell Script Gzip - Z0Ra - Feb 20, 2019

(Feb 20, 2019 12:22 PM)Unk0wn Wrote:  Well I'm by far no expert but google is your best friend and using google I found this

Code
  rem Pick up each file in C:\Temp1\ with .out extension.
  for %%a in ("C:\temp1\*.out") do (

       rem Compress the file to a file with the same name but .gz extension is added.
       gzip -c %%a > %%a.gz

       rem Delete the .out file which has been already compressed.
       del /F /Q %%a
   )
I don't know if this helped that much or not but I hope it did  😁

Legit 2 seconds after this I saw you wanted bash not batch so i can't really help in that sense since I'm a noob when it comes to bash but found something that might help here

Thanks I have done all that research as well, however failing