当前位置:网站首页>自动打包压缩备份下载及删除 bat脚本命令
自动打包压缩备份下载及删除 bat脚本命令
2022-07-28 15:17:00 【viqecel】
注意,如果路径中有空格,要加双引号
::文件不存在.要先建立,防止被误删除.导致备份失败
@echo off
SET SourceFile=C:\inetpub\wwwroot\Runtime\mysql_bak_rar\
if not exist %SourceFile% (
md %SourceFile%
)
::因为有些数据库文件在运行中,没法直接打包.所以需要先复制副本从upload复制到upload1中
copy D:\phpstudy_pro\upload\*.* D:\phpstudy_pro\upload1\
::打包副本 ibck 表示文件名用当日的时间命名
"C:\Program Files\WinRAR\WinRAR.exe" a -ag -ibck "D:\phpstudy_pro\upload2\bak.rar" "D:\phpstudy_pro\upload1"
::pause
::删除复制过来的副本
del /f /s /q D:\phpstudy_pro\upload1\*.*
::删除超过7天的备份,注意,\mysql_bak_rar这个表示文件夹,后面不要加斜线,
forfiles /p "C:\mysql_bak_rar" /s /m *.* /d -7 /c "cmd /c del @path"
::pause
把上面代码放在记事本中,然后文件重命名为.bat结尾的脚本文件,双击就可以执行
如果是服务器中打包,打包后怎么定时自动下载到本地,这里有说明
https://blog.csdn.net/viqecel/article/details/54588430
这里是讲怎么下载.
关于windows系统中怎么复制,打包压缩备份并自己删除,查看这里windows系统中,复制文件,然后打包压缩备份再删除的bat脚本命令_viqecel的博客-CSDN博客
利用flashfxp的队列功能.及电脑的计划任务功能.实现自动下载远程服务器上的文件到本地.
假如,我们要把文件下载到D:\phpStudy\WWW\auto_beifen
1、首先打开flashfxp,连接远程服务器,然后选择远程,以及本地的,将要下载的文件夹或文件,如果不选择,则没法备份到我们指定的位置.
如图
2,然后选择远程要下载的目录或文件,右键点击.再点击 选定的队列
如下图,
3,点击后,左下角,会出现一个队列.再右键点击,然后选择另存为.文件名为auto_beifen 保存到电脑桌面后.
把他复制到我们事先建立好的文件夹中D:\phpStudy\WWW\auto_beifen
文件夹及文件结构如下图.
4,计划任务脚本.在上面文件夹中建立autobak.bat.txt 这个文件,里面内容为
dir D:\phpStudy\WWW\auto_beifen*.fqf /b > D:\phpStudy\WWW\auto_beifen\files.log
for /f %%f in (D:\phpStudy\WWW\auto_beifen\files.log) do (start D:\Progra~1\FlashFXPE_xp510.com\FlashFXP.exe D:\phpStudy\WWW\auto_beifen%%f)
其中Progra~1其实就是Program Files这个文件夹的简写,因为目录中不能用空格.所以替换了
files.log表示临时文件,不用管他.如果你的目录不同,则上面的批量替换一下.
D:\Progra~1\FlashFXPE_xp510.com\FlashFXP.exe 这一段表示软件的安装位置,查看方法如下图,对着运行着的软件.二次右键.点击属性,目标位置,就可以复制了.注意空格问题.
5, autobak.bat.txt 再把这个文件结尾的.txt去掉,就变成脚本文件了.双击这个文件,看下效果吧
6,建立了队列后,为了每次执行自动备份下载的时候遇到同样的文件不需要提示是否覆盖、跳过等,可以在选项–>文件传输规则中设置成:
“日期相等时—跳过” 当然可以有其它规则
不过要注意,下面的一个选项,没有匹配规则,则询问,这里可根据情况选上.否则可能有漏掉的情况.
7,最后就是电脑计划任务,这个具体网上搜索吧.很简单了.另外.注意软件的默认传输模式.这里要选择二进制,以防止出问题.
边栏推荐
- Ethernet to RS485 serial port counter WiFi module LED light controller ibf165
- 头条文章_signature
- 记:数字累加动画
- Image semantic segmentation practice: tensorflow deeplobv3+ train your own dataset
- js 优先级队列
- Notes on October 22, 2021
- JS queue
- Set static IP in NAT mode of virtual machine
- js中的for循环总结
- A tour of grp:05 - GRP server streaming service end stream
猜你喜欢

Detectron2 installation and testing

分体式测斜探头安装要点及注意事项

仅需三步 轻松实现远程办公

CoDeSys realizes bubble sorting

js 链表 01

Mlx90640 infrared thermal imager temperature sensor module development notes (VIII)

动态规划 --- 数位统计DP

Pyqt5 rapid development and practice 5.1 tables and trees

2021 Yahong pen test questions

Installation points and precautions of split angle probe
随机推荐
A good start
Two special functions (arrow function and method)
跳表的实现
LabVIEW Linx toolkit controls Arduino equipment (expansion-1)
2-channel Di high-speed pulse counter, 1-channel encoder to Modbus TCP wired wireless module ibf161
mysql查询 limit 1000,10 和limit 10 速度一样快吗?如果我要分页,我该怎么办?
Using SYSTEMd to manage services
R language uses ggpairs function of ggally package to visualize pairwise relationship graph of grouping multivariable, set alpha parameter to change image transparency, diagonal continuous variable de
js 队列
Redis series 4: sentinel (sentinel mode) with high availability
软考 系统架构设计师 简明教程 | 软件调试
2021 亚鸿笔试题
兆骑科创创新创业大赛人才引进平台,双创赛事高层次人才引进
Zhengda cup hacker marathon data analysis competition
Common problems and precautions of remote serial port server (adapter) uart/i2c/1-wire/spi PS304
不懂就问,快速成为容器服务进阶玩家!
Let's learn the game of beating hamsters
Writing of factorial
Numpy ndarray learning < I > Foundation
SDL2 简明教程(四):用 SDL_IMAGE 库导入图片