1#!/usr/bin/env python 2# -*- coding: utf-8 -*- 3# Copyright (c) 2021 Huawei Device Co., Ltd. 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15 16import os 17import sys 18import fnmatch 19 20 21def FindInDirectory(directory, filename_filter): 22 for root, _dirnames, filenames in os.walk(directory): 23 matched_files = fnmatch.filter(filenames, filename_filter) 24 for file in matched_files: 25 print(os.path.join(root, file)) 26 27 28def main(args): 29 dirs = args 30 for directory in dirs: 31 if os.path.isdir(directory): 32 FindInDirectory(directory, "*.java") 33 return 0 34 35 36if __name__ == '__main__': 37 sys.exit(main(sys.argv[1:]))