3 # Copyright 2014 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
7 """This script is used to find and copy a file that may be found in one or more
8 places. The sources are searched in order and (only) the first one found will
9 be copied to the destination."""
16 parser = optparse.OptionParser()
17 parser.description = __doc__
18 parser.add_option('-d', '--destination')
19 parser.add_option('-s', '--source', default=[], action='append',
20 help='Specify multiple times for multiple sources.')
21 options, args = parser.parse_args()
22 if (not options.destination or not options.source):
23 parser.error('Must specify both a destination and one or more sources.')
26 for src in options.source:
27 if os.path.exists(src):
28 shutil.copyfile(src, options.destination)
31 print "Unable to locate file"