1. FredGan
  2. Simple_BackUP

Commits

FredGan  committed 799de46

Correction Errors

  • Participants
  • Parent commits 1848b37
  • Branches default

Comments (0)

Files changed (2)

File backup.py

View file
  • Ignore whitespace
 ##########################################################################
 import xml.parsers.expat
 import tarfile
+import os
 from datetime import datetime
 
 #List of path backup from XML file with name is "path.xml"
     date=datetime.now().strftime('%Y'"."'%m'"."'%d')
     for i in paths:
         tar = tarfile.open(str(i)+'_'+date+".tar", "w|gz")
-        Add_items(tar,str(paths[i]))
+        for root, dir, files in os.walk(str(paths[i])):
+            for file in files:
+                fullpath = os.path.join(root,file) 
+                try:
+                      Add_items(tar,fullpath)
+                except:
+                      print fullpath
         tar.close()
 #Run processing
 Archive(Path())

File path.xml

View file
  • Ignore whitespace
            <path it = "/mnt/it"></path>
            <path hoz_dog = "/mnt/hoz_dog"></path>
            <path com_dog = "/mnt/com_dog"></path>
+           <path alieparusa = "/mnt/alieparusa.ru"></path>
     </content>