Recursively unzip all compressed files in the current directory and sub-directories and delete the source files

Source: Internet
Author: User
Tags rar
@echo off
setlocal enabledelayedexpansion
 
echo the current batch path is:
echo "%~dp0"
cd/d "%~dp0"

 
for/f " USEBACKQ delims= "%%i in (' dir/a-d/b/S *.rar ') do (
    echo"%%i "
	set rar_path=%%~dpi
	echo"!rar_path! "
        REM changes to the directory where the RAR is located, and then removes the hidden and read-only properties of all RAR files in that directory. Otherwise winrar cannot be processed.
	cd/d "!rar_path!"
	Attrib-h-R "!rar_path!" */s/d
        REM when using the command below, please find the WinRAR help document yourself, so that you can overwrite the existing file directly.
	"C:\Program files\winrar\winrar.exe" X-r-inul-y "!rar_path!\*.rar" *-o-
	
	del "!rar_path!\*.rar"
    
    ) C15/>rem winrar command-line mode, the hidden file cannot be processed automatically, it will not be decompressed, and for a read-only compressed file, you must use the attrib command to remove the-h-r attribute.
rem above the attrib command, which must be followed by an asterisk *, otherwise the attrib command prompts: "File not Found-C:\Users\lm\CMB\PB40\"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.