1
2

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.

pythonで日付時間を名前先頭に入れたバックアップフォルダを作成

Last updated at Posted at 2021-11-07
# shutilがフォルダのコピーライブラリ
import shutil,datetime

# 現在時間
dt_now=datetime.datetime.now()
# 月日時分秒
dt_now=dt_now.strftime("%m%d%H%M%S")


send_fold="D:\\元フォルダ\\"
send_file="元ファイル名"
rece_fold="C:\\Users\\aaa\\Dropbox\\バックアップ先フォルダ\\"
rece_file=dt_now+send_file

send=send_fold+send_file
rece=rece_fold+rece_file

shutil.copytree(send,rece)
1
2
1

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
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?