怎么使用bat从rar文件中删除指定文件夹
RT.
或者, 用bat打rar包的时候 排除 某文件夹也行.
比如我要执行
"c:\Program Files\WinRAR\winrar" a -o+ -ibck -inul -x.svn -r xxx.rar ..\res\*
将会有非常多的svn垃圾信息被打进去.
虽然我设置了 -x.svn 但是可能这个参数和 -r不兼容.
后来我想打完包之后再删除:
call set_each_string.bat
FOR /r %%v IN (*.rar) DO "%rarPath%\winrar" d %%v .svn -r -ibck
pause
让人郁闷的是, d 这个指令只能删除文件,对文件夹没有办法.
感觉这是个很微小的功能啊. bat不可能实现不了吧?
[解决办法]
楼主尝试一下下面的命令行。
"c:\Program Files\WinRAR\winrar" a -o+ -ibck -inul -x*\.svn -x*\.svn\* -r xxx.rar ..\res\*
RAR的帮助明确说了,没有通配符,不会递归。
RAR的帮助如下:
Exclude specified file from operation, wildcards may be used both in the name and file parts of file mask. You may specify the switch -x several times on the same command line.
If mask contains wildcards, it applies to current folder and its subfolders. It is not recursive without wildcards, so if you wish to exclude some "filename" in all folders, you need to specify two masks: "filename" for current folder and "*\filename" for subfolders. If you know an exact path to file, you can use "path\filename" syntax to exclude only this copy of "filename". If you use -xpath\filename syntax when unpacking an archive, "path" must be a path inside of archive, not a file path on the disk after unpacking.
Examples
add all *.exe files, except those beginning with f, to the archive bin
WinRAR a -xf*.* bin *.exe
compress all files on the disk c: except temp folders and files inside of temp folders
WinRAR a -r -x*\temp -x*\temp\* savec c:\*
extract all files except *.txt from docs.rar
WinRAR x -x*.txt docs
[解决办法]
解决问题了吗?
别忘了结贴。