LoginSignup
0
1

More than 5 years have passed since last update.

バックアップファイルを1週間分にするメモ(Windows)

Posted at

環境

環境:Windows
バックアップ先:D:\DBBackupと仮定する

バッチファイルを作成する

backup1week.bat

```shell-session: backup1week.bat
::1週間を超えたデータを削除する

::3←2,2←1,1←今日のデータ
md D:\DBBackup\8days
move D:\DBBackup\7days D:\DBBackup\8days
move D:\DBBackup\6days D:\DBBackup\7days
move D:\DBBackup\5days D:\DBBackup\6days
move D:\DBBackup\4days D:\DBBackup\5days
move D:\DBBackup\3days D:\DBBackup\4days
move D:\DBBackup\2days D:\DBBackup\3days
move D:\DBBackup\1days D:\DBBackup\2days
md D:\DBBackup\1days

::一番古いデータを削除
if %ERRORLEVEL%==0 rd /s /q D:\DBBackup\8days
```

バックアップ作成

D:\DBBackup\1daysにバックアップを作成する。

タスク化

上記をタスク化する。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1