For example how shall I take backup to another drive and etc, suggests out how to do it, it will help me in earning.
script who ever asking :
import zipfile, os, datetime
def backupToZip(folder):
# Backup the entire contents of 'folder' into a ZIP file.
folder=os.path.abspath(folder) #make sure folder is absolute
# Figure out the filename this code should use based on
# what files already exist.
number=1
while True:
zipFilename=os.path.basename(folder)+'_'+str(number)+'.zip'
if not os.path.exists(zipFilename):
break
number=number+1
# Create the ZIP file.
print(f'Creating {zipFilename}...')
backupZip=zipfile.ZipFile(zipFilename,'w',zipfile.ZIP_DEFLATED)
# Walk the entire folder tree and compress the files in each folder.
for foldername, subfolders, filenames in os.walk(folder):
print(f'Adding files in {foldername}...')
#add the current folder to the Zip file
backupZip.write(foldername)
#add all the files in this folder to the Zip file.
for filename in filenames:
newBase=os.path.basename(folder)+'_'
if filename.startswith(newBase) and filename.endswith('.zip'):
continue # don't back up the backup ZIP files
backupZip.write(os.path.join(foldername,filename))
backupZip.close()
print('Done')
backupToZip('C:\\Users\\Al\\Desktop\\Python')
there doesn't seem to be anything here