blob: 73d2bddeca6befa3786021dad25f942bcce68a2e [file] [log] [blame]
Joe Gregorioc47fab72011-07-06 08:29:20 -04001#!/usr/bin/python2.4
2# -*- coding: utf-8 -*-
3#
4# Copyright (C) 2010 Google Inc.
5#
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17
18"""Copy files from source to dest expanding symlinks along the way.
19"""
20
Joe Gregoriob17c7632011-04-05 01:31:55 -040021from distutils.dir_util import copy_tree
22
Joe Gregorioc47fab72011-07-06 08:29:20 -040023import gflags
24import sys
25
26
27FLAGS = gflags.FLAGS
28
29gflags.DEFINE_string('source', '.', 'Directory name to copy from.')
30gflags.DEFINE_string('dest', 'snapshot', 'Directory name to copy to.')
31
32
33def main(argv):
34 # Let the gflags module process the command-line arguments
35 try:
36 argv = FLAGS(argv)
37 except gflags.FlagsError, e:
38 print '%s\\nUsage: %s ARGS\\n%s' % (e, argv[0], FLAGS)
39 sys.exit(1)
40
41 copy_tree(FLAGS.source, FLAGS.dest, verbose=True)
42
43
44if __name__ == '__main__':
45 main(sys.argv)