怎么使用bat从rar文件中删除指定文件夹

chichenzhe 2012-06-05 04:54:35
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不可能实现不了吧?
...全文
688 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
cinderella_2008 2014-02-07
  • 打赏
  • 举报
回复
能详细点不 造福百姓啊
chichenzhe 2012-06-06
  • 打赏
  • 举报
回复
用其他方式解决了. 先xcopy
dsd999 2012-06-06
  • 打赏
  • 举报
回复
解决问题了吗?

别忘了结贴。
chichenzhe 2012-06-06
  • 打赏
  • 举报
回复
谢谢.
Nosky100 2012-06-06
  • 打赏
  • 举报
回复
楼主尝试一下下面的命令行。
"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

5,174

社区成员

发帖
与我相关
我的任务
社区描述
其他开发语言 Office开发/ VBA
社区管理员
  • Office开发/ VBA社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧