Path: blob/main/utils/remove-file-by-suffix.py
1560 views
#!/usr/bin/env python12# Copyright 2015 The Shaderc Authors. All rights reserved.3#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 at7#8# http://www.apache.org/licenses/LICENSE-2.09#10# Unless required by applicable law or agreed to in writing, software11# 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 and14# limitations under the License.1516# Removes all files with a certain suffix in a given path recursively.1718# Arguments: path suffix1920import os21import sys222324def main():25path = sys.argv[1]26suffix = sys.argv[2]27for root, _, filenames in os.walk(path):28for filename in filenames:29if filename.endswith(suffix):30os.remove(os.path.join(root, filename))313233if __name__ == '__main__':34main()353637