Mar-10-2019, 12:00 PM
(This post was last modified: Mar-10-2019, 12:02 PM by Richard_SS.)
The programm should create a backup of selected folder into a folder with a name as current data, and backed up archive should be named as current time. When running a programm im getting a following error: "zip error: Nothing to do! (D://Backup/20190310/165535.zipC://justfolder C://justfolder2.zip)"
What am i doing wrong?
p.s. im not native english speaker, so, dont ,please, scold me for mistakes, if there are some :D
Here is the code of program:
What am i doing wrong?
p.s. im not native english speaker, so, dont ,please, scold me for mistakes, if there are some :D
Here is the code of program:
import os
import time
source = ['"C://justfolder "','C://justfolder2']
target_dir = 'D://Backup'
today = target_dir + os.sep + time.strftime('%Y%m%d')
now = time.strftime('%H%M%S')
if not os.path.exists(today):
os.mkdir(today) #make directory
print('Successfully created directory', today)
else:
print("Already exists")
target = today + os.sep + now + '.zip'
zip_command = "zip -r {0}{1}". format(target,''.join(source))
if os.system(zip_command) == 0 :
print('Successful backup to', target)
else:
print('Backup Failed')
