写批处理脚本重命名和移动文件7zip的 [英] Write script in batch to rename and move the file in 7zip
问题描述
我的7-Zip是安装在
My 7-zip is installed in
C:\\ Program Files文件\\的7-Zip
C:\Program Files\7-Zip
和我的源日志文件的位置为
and my source log file location is
E:\\ OracleGrid \\ 11.2.0 \\网\\日志\\诊断\\ TNSLSNR \\ enctcorl010 \\监听\\跟踪\\ LISTENER.LOG
E:\OracleGrid\11.2.0\grid\log\diag\tnslsnr\enctcorl010\listener\trace\listener.log
有中只有一个有日志文件。我想通过像当前日期名称重命名为压缩它的 LISTNER_DDMMYY.ZIP ,以新的目的地。
There is only one log file in there. I want to zip it by renaming name like current date LISTNER_DDMMYY.ZIP to new destination to
E:\\ DBA_CMDS \\ Maintenance_Tasks \\ ClearListenerLog \\ ArchivedListenerLogs
E:\DBA_CMDS\Maintenance_Tasks\ClearListenerLog\ArchivedListenerLogs
我AP preciate如果有人能帮助我在批处理脚本写的,因为我是新来这个脚本。我AP preciate你的帮助。
I would appreciate if someone can help me to write in batch script since I am new to this script. I appreciate your help.
推荐答案
试试这个:
@ECHO OFF
"c:\program files\7-zip\7z" a E:\DBA_CMDS\Maintenance_Tasks\ClearListenerLog\ArchivedListenerLogs\listen_%date:~7,2%%date:~4,2%%date:~12,2%.zip E:\OracleGrid\11.2.0\grid\log\diag\tnslsnr\enctcorl010\listener\trace\listener.log
IF ERRORLEVEL 0 DEL E:\OracleGrid\11.2.0\grid\log\diag\tnslsnr\enctcorl010\listener\trace\listener.log
这假设7-zip命令行已经安装在你提到的7-ZIP目录。它是一个独立的下载/安装。
HTH。
This assumes that the 7-zip command line has been installed in the 7-zip directory you mention. It is a separate download / install. HTH.
这篇关于写批处理脚本重命名和移动文件7zip的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!