Skip to content

Commit 70271c5

Browse files
author
Jared Manning
committed
Tidy up comments and syntax
1 parent e95002a commit 70271c5

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

backup_automater_services.py

+20-19
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
11
# Script Name : backup_automater_services.py
22
# Author : Craig Richards
33
# Created : 24th October 2012
4-
# Last Modified :
5-
# Version : 1.0
4+
# Last Modified : 13th February 2016
5+
# Version : 1.0.1
66

7-
# Modifications :
7+
# Modifications : 1.0.1 - Tidy up the comments and syntax
88

99
# Description : This will go through and backup all my automator services workflows
1010

1111
import shutil # Load the library module
1212
import datetime # Load the library module
13-
import os # Load the library module
13+
import os # Load the library module
1414

15-
today=datetime.date.today() # Get Today's date
16-
todaystr=today.isoformat() # Format it so we can use the format to create the directory
15+
today = datetime.date.today() # Get Today's date
16+
todaystr = today.isoformat() # Format it so we can use the format to create the directory
1717

18-
confdir=os.getenv("my_config") # Set the variable by getting the value from the OS setting
19-
dropbox=os.getenv("dropbox") # Set the variable by getting the value from the OS setting
20-
conffile = ('services.conf') # Set the variable as the name of the configuration file
21-
conffilename=os.path.join(confdir, conffile) # Set the variable by combining the path and the file name
22-
sourcedir=os.path.expanduser('~/Library/Services/') # Source directory of where the scripts are located
23-
destdir=os.path.join(dropbox, "My_backups"+"/"+"Automater_services"+todaystr+"/") # Combine several settings to create the destination backup directory
24-
25-
for file_name in open(conffilename): # Walk through the configuration file
26-
fname = file_name.strip() # Strip out the blank lines from the configuration file
27-
if fname: # For the lines that are not blank
28-
sourcefile=os.path.join(sourcedir, file_name.strip()) # Get the name of the source files to backup
29-
destfile=os.path.join(destdir, file_name.strip()) # Get the name of the destination file names
30-
shutil.copytree(sourcefile, destfile) # Copy the directories
18+
confdir = os.getenv("my_config") # Set the variable by getting the value from the OS setting
19+
dropbox = os.getenv("dropbox") # Set the variable by getting the value from the OS setting
20+
conffile = ('services.conf') # Set the variable as the name of the configuration file
21+
conffilename = os.path.join(confdir, conffile) # Set the variable by combining the path and the file name
22+
sourcedir = os.path.expanduser('~/Library/Services/') # Source directory of where the scripts are located
23+
destdir = os.path.join(dropbox, "My_backups"+"/"+"Automater_services"+todaystr+"/") # Combine several settings to create
24+
25+
# the destination backup directory
26+
for file_name in open(conffilename): # Walk through the configuration file
27+
fname = file_name.strip() # Strip out the blank lines from the configuration file
28+
if fname: # For the lines that are not blank
29+
sourcefile = os.path.join(sourcedir, file_name.strip()) # Get the name of the source files to backup
30+
destfile = os.path.join(destdir, file_name.strip()) # Get the name of the destination file names
31+
shutil.copytree(sourcefile, destfile) # Copy the directories

0 commit comments

Comments
 (0)