I try this but can not exist to command on FOR DO
FOR %%F in (D:\dnews\BAG\TEMP\*.gz) DO (C:\dnews\UTL\gzip -d "%%F") | (IF %ERRORLEVEL% EQU 1 DEL /S "%%F")
>> FOR %%F in (D:\dnews\BAG\TEMP\*.gz) DO (C:\dnews\UTL\gzip -d "%%F") = take each *.GZ file un-archive them
if get a ERR Run this (IF %ERRORLEVEL% EQU 1 DEL /S "%%F")
The >%ERRORLEVEL% EQU 1 Mean if ERR can not unarchive DELL /S *.GZ
I do not find the err but understand not work
Batch to Verify all files *.gz and delete the Bad GZ file
Moderator: DosItHelp
Re: Batch to Verify all files *.gz and delete the Bad GZ fil
Code: Select all
@echo off
FOR %%F in (*.gz) DO call :test "%%F"
goto :eof
:test
gzip -t %1
IF %ERRORLEVEL% EQU 1 DEL /q %1
goto :eof