Skip to content

Instantly share code, notes, and snippets.

@sarkrui
Last active February 23, 2023 09:48
Show Gist options
  • Save sarkrui/cb3e8a879b200738a75f8190509aee14 to your computer and use it in GitHub Desktop.
Save sarkrui/cb3e8a879b200738a75f8190509aee14 to your computer and use it in GitHub Desktop.
备份微信聊天记录
#! /bin/bash
#change working directory to Desktop
cd ~/Desktop
# remove any previously existing compressed files
rm -f WeChat_history*
# generate the new updated
tar -vczf ~/Desktop/WeChat_history$(date +%F_%R).tgz ~/Library/Containers/com.tencent.xinWeChat/Data/Library/Application\ Support/com.tencent.xinWeChat
# shall config rclone at the first place
# push to Google Drive name Team, (Google Team Drive has 5T storage)
# under the root (/) directory,
# and shows progress by -P
rclone sync ~/Desktop/WeChat_history* Team:/ -P
echo "Done!"
@sarkrui
Copy link
Author

sarkrui commented Jun 5, 2020

Crontab Usage

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7)
# |  |  |  |  |
# *  *  *  *  *   command to be executed

Links

@sarkrui
Copy link
Author

sarkrui commented Jun 14, 2020

tar 原生不支持加密,可以自行安装 7-zip -pYourPasswd 加密文件夹

brew install p7zip
7z a  ~/Desktop/WeChat_history$(date +%F_%R).7z ~/Library/Containers/com.tencent.xinWeChat/Data/Library/Application\ Support/com.tencent.xinWeChat -pYourPasswd

命令解释

7z        : name and path of 7-Zip executable
a         : add to archive
secure.7z : name of destination archive
*         : add all files from current directory to destination archive
-pSECRET  : specify the password "SECRET"

参考:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment