Solved

gzip on windows nt4 server batch file. No overwrite.

Posted on 2008-06-13
4
827 Views
Last Modified: 2013-12-28
Hi ,
Nightly im copying over gz files from another server. Then uncompressing them with:
gzip -f -k -d c:\files\*.gz

If the folder already contains gz which it does , it overwrite the uncompressed file again each night ( i remove this on a regular basis but need to keep them for a week..)

When i remove the force swtich im asked to confirm yes/no for overwrite.

How do i build this into a Batch file?

Cheers!
0
Comment
Question by:stephengriffin
  • 3
4 Comments
 
LVL 33

Accepted Solution

by:
knightEknight earned 50 total points
ID: 21778362
@echo off
c:
cd c:\files
for /f %%F in ('dir/b *.gz') do @echo N | gzip -k -d %%F
0
 
LVL 1

Author Comment

by:stephengriffin
ID: 21778399
Hi , thanks v much , can you let me know which variables I need to change..

ie the dir/b .. does this relate to a specific dir?
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 21778444
in the script I set the current working directory to match the directory the files are in with this two lines:

  c:
  cd c:\files

change these as appropriate and the script should work as is.
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 21778452
^ should say "with THESE two lines:"
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
In this article, I will show you HOW TO: Install VMware Tools for Windows on a VMware Windows virtual machine on a VMware vSphere Hypervisor 6.5 (ESXi 6.5) Host Server, using the VMware Host Client. The virtual machine has Windows Server 2016 instal…
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question