Skip to content

Commit

Permalink
works without a source directory now - just keeps directories synced
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Fiers committed May 22, 2012
1 parent 9880f72 commit c3285fa
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions template2/sync.run.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ def errex(message):
if ignore:
print "ignoring", ignore

if not source:
errex("source directory is not defined")

if not os.path.isdir(source):
errex("Source is not a directory")

print "Source directory: %s" % source
if source:
print "source directory is not defined"
SOURCE=False
elif os.path.isdir(source):
SOURCE=True
print "Source directory: %s" % source
else:
SOURCE=False
print "No source - just syncing"

lastAccessTime = 0
lastAccessDir = None
Expand Down Expand Up @@ -79,15 +81,21 @@ def errex(message):
sys.exit(-1)


print "start parsing the source directory"
originalConf = os.path.join(original, '.moa', 'config')

sourcelist = [x for x in os.listdir(source) if os.path.isdir(x)]
if os.path.exists('_ref'):
sourcelist.append('_ref')
if SOURCE:
print "start parsing the source directory"
sourcelist = [x for x in os.listdir(source) if os.path.isdir(x)]
if os.path.exists('_ref'):
sourcelist.append('_ref')

#make sure we're not copying the file to itself
sourcelist.remove(original)

#make sure we're not copying the file to itself
sourcelist.remove(original)
else:
#no sourcelist - just get a list of local directories
sourcelist = [x for x in os.listdir('.') if os.path.isdir(x)]

print "Syncing %s to %d target(s)" % (original, len(sourcelist))
for indir in sourcelist:
Expand Down

0 comments on commit c3285fa

Please sign in to comment.