为什么使用 WinRAR 归档文件夹的批处理文件需要比预期更长的时间才能完成?

发布于 2024-09-05 23:33:24 字数 615 浏览 2 评论 0原文

我有一个脚本,它将所有文件夹和文件从 c:\projects 目录移动到 c:\backup 中的 RAR 存档中。

for /f "delims==" %%D in ('DIR C:\projects /A /B /S') do (
    "C:\Program Files\WinRAR\WinRAR.EXE" m -r "c:\backup\projects.rar" "%%D"
)

我还尝试了以下脚本,它使用相同的源 c:\projects,但为 c:\projects 中的每个文件夹创建一个单独的存档: \备份。

FOR /F "DELIMS==" %%D in ('DIR C:\projects /AD /B') DO (
    "C:\Program Files\WinRAR\WinRAR.EXE" m -r "C:\Backup\%%D.rar" "%%D"
)

第二个脚本只需要两个小时即可运行,而我的第一个脚本则需要 24 小时以上才能运行。

有什么办法可以让我的第一个脚本更快吗?

我的第一个脚本不应该更快吗?

I have this script which moves all my folders and files from my c:\projects directory into a RAR archive in c:\backup.

for /f "delims==" %%D in ('DIR C:\projects /A /B /S') do (
    "C:\Program Files\WinRAR\WinRAR.EXE" m -r "c:\backup\projects.rar" "%%D"
)

I have also tried the below script which uses the same source c:\projects, but creates a separate archive for each folder in c:\projects in c:\backup.

FOR /F "DELIMS==" %%D in ('DIR C:\projects /AD /B') DO (
    "C:\Program Files\WinRAR\WinRAR.EXE" m -r "C:\Backup\%%D.rar" "%%D"
)

This second script only takes two hours to run while my first script takes over 24 hours to run.

Is there any way to make my first script faster?

Shouldn't my first script be faster at all?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

叹沉浮 2024-09-12 23:33:24

我的猜测是,您的“c:\backup\projects.rar”存档是一个可靠的存档,这意味着每次向其中添加内容时都需要完全重新打包。
尝试将其更改为非实体存档,我认为您应该会看到改进。

您可以尝试的第二件事是使用要添加的文件夹的文件列表(甚至掩码)对 WinRar 进行一次调用,而不是为每个文件夹单独调用它。

My guess is that your "c:\backup\projects.rar" archive is a solid archive, which means that it needs to be re-packed entirely each time you add something to it.
Try changing it to non-solid archive and I think you should see improvement.

The second thing you could try is to do a single call to WinRar with file-list (or even a mask) of what folders to add instead of calling it independently for each folder.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文