3 # (Be in -*- python -*- mode.)
5 # ====================================================================
6 # Copyright (c) 2006 CollabNet. All rights reserved.
8 # This software is licensed as described in the file COPYING, which
9 # you should have received as part of this distribution. The terms
10 # are also available at http://subversion.tigris.org/license-1.html.
11 # If newer versions of this license are posted there, you may use a
12 # newer version instead, at your option.
14 # This software consists of voluntary contributions made by many
15 # individuals. For exact contribution history, see the revision
16 # history and logs, available at http://cvs2svn.tigris.org/.
17 # ====================================================================
19 """Search a directory for files whose names contain illegal characters.
21 Usage: find_illegal_filenames.py PATH ...
23 PATH should be a directory. It will be traversed looking for
24 filenames that contain characters that are not allowed in paths in an
30 sys
.path
.insert(0, os
.path
.dirname(os
.path
.dirname(sys
.argv
[0])))
32 from cvs2svn_lib
.common
import FatalError
33 from cvs2svn_lib
.collect_data
import verify_filename_legal
35 def visit_directory(unused
, dirname
, files
):
37 path
= os
.path
.join(dirname
, file)
39 verify_filename_legal(path
)
41 sys
.stderr
.write('File %r contains illegal characters!\n' % path
)
44 sys
.stderr
.write('usage: %s PATH ...\n' % sys
.argv
[0])
47 for path
in sys
.argv
[1:]:
48 os
.path
.walk(path
, visit_directory
, None)