批处理文件 - 需要 7-zip 的替代品 - 无法移动 [英] Batch file - Need an Alternative to 7-zip - cannot move

查看:22
本文介绍了批处理文件 - 需要 7-zip 的替代品 - 无法移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请参阅下面的更新答案

Windows 批处理文件.

Windows Batch files.

我非常喜欢 7-Zip 并且效果很好,但喜欢 WinZip 移动和时间戳文件的能力.但是,例如,WinZip(命令行界面)对文件大小和存档中的文件数量有限制.

I absolutely love 7-Zip and works great, but like WinZip's ability to move and timestamp files. However, WinZip's (command-line interface) has limitations for the size of files and the quantity of files within an archive, for example.

谷歌搜索我们确实看到有一个人,他确实使用了 7-zip 的代码并重新编译了代码以使用 -m(移动)开关.但是,我对在我们的生产环境中使用 7-zip 开发人员之外的第三方感到不舒服.

Googling we do see that there is a person, who did take 7-zip's code and has re-compiled the code to use an -m (move) switch. However, I don't feel comfortable about using a third-party outside of the Developer of 7-zip in our Production environment.

另外,我看到了 - http://alternativeto.net/software/7-zip/

我已经编码:IF NOT ERRORLEVEL 1(在 Zip 过程之后)删除文件,但如果有多个相同的文件名结构,这将是不安全的.

I have coded: IF NOT ERRORLEVEL 1 (after the Zip process) to delete the file, but this cannot be safe if there are multiple of the same file name structure.

以下是一些示例代码:7zip:

Here are some sample bits of code: 7zip:

D:scripts7za -tzip -y a Dzips20140116_someclient_%computername%@%location%.zip D:logsapache_log.2014-01-16* >nul >>%logfile%
IF NOT ERRORLEVEL 1 ECHO Y|DEL D:logsapache_log.2014-01-16*

apache_log在哪里.2014-01-16可能是:

Where apache_log.2014-01-16 could be:

apache_log.2014-01-16.1
apache_log.2014-01-16.2
apache_log.2014-01-16.3

WinZip

c:progra~1WinZipWzzip.exe -T -ex -m Dzips20140116_someclient_%computername%@%location%.zip D:logssome_file.2014-01-16* >nul >>%logfile%

我想从软件需求的角度来看,我想在 7Zip 中拥有 WinZip 的一些功能.我喜欢 7Zip,因为它能够处理大型档案.我喜欢 PeaZip,很多个月前我使用过 PowerArchiver.我遇到的问题是我正在使用适用于 Windows 的 Apache Tomcat,我们必须归档每小时可能超过 200-300 MB 的日志,并且需要让服务器清除旧日志.

I guess from a software requirements standpoint, I would like to have some of the abilities of WinZip in 7Zip.. I like 7Zip as it has the ability to work with large Archives. I like PeaZip and I used PowerArchiver many moons ago. Problem I have is that I am working with Apache Tomcat for Windows, and we have to archive off hourly logs that can be over 200-300 MB an hour and need to keep the servers clear of old logs.

希望这更有意义.

更新:

相信我已经回答了我自己的问题..

Do believe that I have answered my own question..

FOR /F %%F IN ('dir /B "D:serverlogsserver.log.2014-01-19*"') DO (
D:workscripts7za.exe –tzip –y a "D:ziplogs201401109_COMPANY_SERVERNAME@DATACENTER.ZIP" >> D:WORKSCRIPTSLOGSLOG_20140120.LOG && DEL "D:serverlogs\%%F"
)

现在效果很好.

推荐答案

7-Zip 的最新 alpha 版本支持新的开关-sdel"以在包含到存档后删除文件.

Latest alpha versions of 7-Zip support new switch "-sdel" to delete files after including to archive.

这篇关于批处理文件 - 需要 7-zip 的替代品 - 无法移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆