Browse files

Fixes #4

  • Loading branch information...
1 parent 2fa6079 commit c816bd6efbfb5391c12ee975645c6d313eab5107 Adam DePrince committed Mar 5, 2013
Showing with 9 additions and 1 deletion.
  1. +9 −1 autosync/
@@ -9,7 +9,7 @@
import autosync.actors.s3
from autosync.files import File
import os.path
+import re
import gflags
@@ -20,6 +20,8 @@
gflags.DEFINE_string('target_prefix', '', 'The "directory" within the target to write files into')
+gflags.DEFINE_string('source_filter', '^.*$', 'Only accept files that match this regex')
gflags.DEFINE_string('source_prefix', None, 'The path to strip from the local file name\' absolute path. This works like s3cmd\'s -P flag or acts like the current directory would when rsyncing, scping or taring non-absolute paths')
gflags.DEFINE_string('actor', 's3', 'The full name of the module and class use to generate a connection to the target. So if you created a connection object called my.foobar.Connection yuo would type --actor=my.foobar.Connection. Moduled included with autosync (i.e. autosync.actors.*.Connection) can be abbreviated with the base module name (i.e. --actor=s3)')
@@ -113,7 +115,13 @@ def filename_to_File(self, path):
class SyncState(State):
+ RE = None
+ def acceptable(self, s):
+ if self.RE is None:
+ self.RE = re.compile(FLAGS.source_filter)
+ return bool(self.RE.match(s))
def add_path_to_que(self, path):

0 comments on commit c816bd6

Please sign in to comment.