|
12 | 12 | import datetime # Load the library module |
13 | 13 | import os # Load the library module |
14 | 14 |
|
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 |
17 | 17 |
|
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 |
| 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 | 24 |
|
25 | 25 | # the destination backup directory |
26 | 26 | for file_name in open(conffilename): # Walk through the configuration file |
27 | 27 | fname = file_name.strip() # Strip out the blank lines from the configuration file |
28 | 28 | if fname: # For the lines that are not blank |
29 | | - sourcefile = os.path.join(sourcedir, fname) # Get the name of the source files to backup |
30 | | - destfile = os.path.join(destdir, fname) # Get the name of the destination file names |
31 | | - shutil.copytree(sourcefile, destfile) # Copy the directories |
| 29 | + sourcefile = os.path.join(sourcedir, fname) # Get the name of the source files to backup |
| 30 | + destfile = os.path.join(destdir, fname) # Get the name of the destination file names |
| 31 | + shutil.copytree(sourcefile, destfile) # Copy the directories |
0 commit comments