{"action":"created","issue":{"url":"https://api.github.com/repos/wissol/sppy/issues/15","labels_url":"https://api.github.com/repos/wissol/sppy/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/wissol/sppy/issues/15/comments","events_url":"https://api.github.com/repos/wissol/sppy/issues/15/events","html_url":"https://github.com/wissol/sppy/issues/15","id":53523801,"number":15,"title":"Understanding the backup process","user":{"login":"csoliss","id":7979619,"avatar_url":"https://avatars.githubusercontent.com/u/7979619?v=3","gravatar_id":"","url":"https://api.github.com/users/csoliss","html_url":"https://github.com/csoliss","followers_url":"https://api.github.com/users/csoliss/followers","following_url":"https://api.github.com/users/csoliss/following{/other_user}","gists_url":"https://api.github.com/users/csoliss/gists{/gist_id}","starred_url":"https://api.github.com/users/csoliss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/csoliss/subscriptions","organizations_url":"https://api.github.com/users/csoliss/orgs","repos_url":"https://api.github.com/users/csoliss/repos","events_url":"https://api.github.com/users/csoliss/events{/privacy}","received_events_url":"https://api.github.com/users/csoliss/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/wissol/sppy/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-06T15:10:31Z","updated_at":"2015-01-08T21:41:05Z","closed_at":null,"body":"I am try to understand the backup process, because I try to improve.\r\nthe process is the next:\r\n* create the \"backup\" and tmp folder, if doesn't exists\r\n   * generate_backup_directories()\r\n* create a backup filename\r\n   * backup_file_names = generate_backup_file_names(backup_directory, file_names)\r\n* then I lost... :(\r\n\r\nsomeone can help me?"},"comment":{"url":"https://api.github.com/repos/wissol/sppy/issues/comments/69254380","html_url":"https://github.com/wissol/sppy/issues/15#issuecomment-69254380","issue_url":"https://api.github.com/repos/wissol/sppy/issues/15","id":69254380,"user":{"login":"wissol","id":4045265,"avatar_url":"https://avatars.githubusercontent.com/u/4045265?v=3","gravatar_id":"","url":"https://api.github.com/users/wissol","html_url":"https://github.com/wissol","followers_url":"https://api.github.com/users/wissol/followers","following_url":"https://api.github.com/users/wissol/following{/other_user}","gists_url":"https://api.github.com/users/wissol/gists{/gist_id}","starred_url":"https://api.github.com/users/wissol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wissol/subscriptions","organizations_url":"https://api.github.com/users/wissol/orgs","repos_url":"https://api.github.com/users/wissol/repos","events_url":"https://api.github.com/users/wissol/events{/privacy}","received_events_url":"https://api.github.com/users/wissol/received_events","type":"User","site_admin":false},"created_at":"2015-01-08T21:41:05Z","updated_at":"2015-01-08T21:41:05Z","body":"most of the work is done by the following function:\r\n\r\n```\r\ndef backup_file(work_file, backup_file_name):\r\n    # copy work back up file to a new time-stamped backup file\r\n    temporal_backup_file = backup_file_name[:10] + temporary_backup_directory + backup_file_name[10:-4] + time.strftime(\"%d_%m_%Y_at_%H_%M\")+ '.csv'\r\n    shutil.copy2(work_file,temporal_backup_file)\r\n    \r\n    # append to work backup file    \r\n    shutil.copy2(work_file,backup_file_name)\r\n````\r\n\r\nfirst, it creates a timestamped backup file\r\nthen, it updates the main backup file\r\n\r\nThe idea is to have both a \"current\" backup file and time-stamped backup files, just in case you need to trace back something you lost by acciddent"}}