-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tsai1993
committed
Aug 24, 2020
1 parent
9a7902d
commit c15469e
Showing
3 changed files
with
43 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ dump | |
*?deploy.sh | ||
j*b/ | ||
ga.png | ||
*.tar* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import shutil, os, tarfile | ||
from commons import * | ||
|
||
dir = os.path.abspath('./dump/') | ||
|
||
basename = '2047backup_'+time_iso_now().replace(':','').replace('-','') | ||
basename_p = basename.replace('backup_', 'backup_publish_') | ||
|
||
print('working on', dir) | ||
|
||
# https://stackoverflow.com/a/38883728 | ||
tar = tarfile.open(basename+'.tar',"w") | ||
tar.add('dump') | ||
tar.close() | ||
|
||
def accept(fn): | ||
nope = 'conversations histories messages logs passwords invitations'.split(' ') | ||
# for obvious reasons | ||
for k in nope: | ||
if k in fn: | ||
return False | ||
return True | ||
|
||
tar = tarfile.open(basename_p+'.tar',"w") | ||
tar.add('dump', filter=lambda x: x if accept(x.name) else None) | ||
tar.close() |