0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Xserverで不要ファイルを定期的に移動する

Posted at

Xserverで検索に一致するディレクトリを定期的に別のディレクトリに移動する

mv.sh
#!/bin/bash

# 32日より前のファイルを移動
find /home/サーバーID/ドメイン/public_html/hoge/* -type d -mtime +32 | xargs --no-run-if-empty mv -t /home/サーバーID/backup/hoge/

-type f:対象をファイルにする
-type d:対象をディレクトリにする
-mtime +x・・・過去からx+1日前までを対象とする

アップロードして、パーミッションは「704」に変更する

cronを設定する

/home/サーバーID/backup/file_mv.sh
0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?