ZIP和使用批处理命令在循环删除目录 [英] Zip and Delete Directory in Loop using Batch Command

查看:110
本文介绍了ZIP和使用批处理命令在循环删除目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个批处理命令。因为它遵循。它可以压缩的目录在其他目录。

I have a batch command. As it follows. It can zip directories in other directory.

@echo off
    set "zip=7z a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on"
    set "directory=C:\SqlData\BackUpData"
    for /d %%i in ("%directory%\*") do %zip% "%%~fi.7z" "%%~fi\*"

我要添加更多的线。压缩后应删除原始文件。
谢谢你。

I want to add one more line. It should delete original file after zipped. Thanks.

推荐答案

如果我理解正确,我觉得这是你要找的线路:

If I understand you correctly, I think this is the line you're looking for:

for /d %%i in ("%directory%\*") do del "%%~fi\*.*" /q

这篇关于ZIP和使用批处理命令在循环删除目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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