用于删除旧备份的脚本或实用程序
我正在为我正在设置的共享点服务器创建备份策略。
每天都有备份运行。
从长远来看,我想保留:
* Daily backups for the last week.
* Weekly backups for the last month.
* Monthly backups for the last year.
* Yearly backups.
如果我在 bash/cygwin 中编写,我会发现编写脚本来清除此策略不需要的备份相当容易。然而,我宁愿不必安装 cygwin,我宁愿使用本机 DOS 脚本或其他一些专用工具来安装。
我的 DOS 脚本编写技能非常原始,所以我想知道是否其他人有我可以使用的类似脚本/实用程序。
干杯!
I'm creating a backup strategy for a sharepoint server I'm setting up.
Have got a backup running daily.
In the long term I'd like to keep:
* Daily backups for the last week.
* Weekly backups for the last month.
* Monthly backups for the last year.
* Yearly backups.
If I was writing in bash/cygwin I would find it fairly easy to write a script to purge backups that are not required by this strategy. However I would rather not have to install cygwin, I'd rather do it with native DOS scripting, or some other specialized tool.
My DOS scripting skills are very primitive, so I was wondering if anyone else had a similar script/util I could use.
Cheers!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 PowerShell 来实现相当复杂的备份过程。或者您可以使用 Python 或其他可执行脚本语言编写脚本。
PowerShell 一开始可能会很复杂,但它基本上是批处理脚本破解 可以访问 .NET 运行时。
注意:我相信 PowerShell 只能在 2003、Vista、Windows 7 上使用(我知道它是它们附带的,至少它可能适用于 XP/2000,但我不确定)。 Python 几乎可以安装在任何东西上。
You could use PowerShell to achieve a rather compelx backup procedure. Or you could write the script in Python or another executable scripting language.
PowerShell can be convoluted at first, but it's basically Batch Scripts on crack with access to the .NET Runtime.
Note: PowerShell I believe is only availiable on 2003, Vista, Windows 7 (I know it comes with them, at least, it may work with XP/2000, but im not sure). Python can be installed on prettymuch anything.
我最终编写了一个 bash 脚本来做到这一点。 run-backup-maintenance.sh
使用示例:run-backup-maintenance.sh d7w4m12y10 /cygdrive/d/backup ".*.tar"
注意:所有每日备份必须写入:/cygdrive/d/backup/daily
如果运行使用参数 d7w4m12y10,此脚本可确保随着时间的推移:
享受!
I ended up writing a bash script to do this. run-backup-maintenance.sh
Usage example: run-backup-maintenance.sh d7w4m12y10 /cygdrive/d/backup ".*.tar"
NOTE: All daily backups must be written to: /cygdrive/d/backup/daily
If run with the parameter d7w4m12y10, this script ensures that over time:
Enjoy!