Skip to content

Instantly share code, notes, and snippets.

View mshiyaf's full-sized avatar
🎯
Focusing

Mohammed Shiyaf C mshiyaf

🎯
Focusing
View GitHub Profile
@mshiyaf
mshiyaf / backup_with_loading.py
Last active August 29, 2020 07:25
Python script to convert folder to tar.gz for backing up with loading and progress bar in terminal.
#!/Users/mshiyaf/.pyenv/shims/python
import os
import tarfile
import time
import sys
def waiting(lenstr=20, zzz=0.5, dispstr='Backing up your files'):
dots = '.' * lenstr
spaces = ' ' * lenstr
print(dispstr.center(50, '*'))
@mshiyaf
mshiyaf / backup_script.py
Created August 28, 2020 17:28
Python script to convert a folder to tar file and replace file only if changes occur.
#!/Users/mshiyaf/.pyenv/shims/python
import os
import tarfile
import time
def tardir(path,tar_name):
tar_log = open('/Users/mshiyaf/Code/backup_mod.log','w')
try:
with tarfile.open('/Users/mshiyaf/Code/Texol_Backup.tar','r') as tar:
file_name_array = []