Skip to content

Instantly share code, notes, and snippets.

@jgillmanjr
Last active May 9, 2023 01:45
Show Gist options
  • Save jgillmanjr/e6865cffa7982f5cb741dd4cd0eb8e5f to your computer and use it in GitHub Desktop.
Save jgillmanjr/e6865cffa7982f5cb741dd4cd0eb8e5f to your computer and use it in GitHub Desktop.
Kilohearts Backup (Windows)
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true,
"ExecuteTime": {
"end_time": "2023-05-09T01:37:46.820139800Z",
"start_time": "2023-05-09T01:37:46.763138800Z"
}
},
"outputs": [],
"source": [
"from pathlib import Path\n",
"from zipfile import ZipFile\n",
"import pendulum"
]
},
{
"cell_type": "code",
"execution_count": 3,
"outputs": [],
"source": [
"khs_dir = Path('C:/ProgramData/Kilohearts')\n",
"\n",
"# We only want the config files\n",
"zip_file = f\"\"\"Kilohearts Backup - {(pendulum.now().to_datetime_string()).replace(':', '_')}.zip\"\"\"\n",
"with ZipFile(zip_file, 'w') as f:\n",
" for pf in khs_dir.rglob('*.conf'):\n",
" f.write(pf)"
],
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2023-05-09T01:37:46.925140600Z",
"start_time": "2023-05-09T01:37:46.817140200Z"
}
}
},
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [],
"metadata": {
"collapsed": false
}
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment