| #!/usr/bin/env python |
| # Copyright 2024 The Chromium Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import os |
| import sys |
| |
| |
| defRemoveAllStaleFiles(paths): |
| """Check if any stale files (e.g. old GCS archives) are on filesystem, and |
| remove them.""" |
| for pathin paths: |
| try: |
| if os.path.exists(path)andnot os.path.isdir(path): |
| os.remove(path) |
| exceptOSError: |
| # Wrap OS calls in try/except in case another process touched this file. |
| pass |
| |
| |
| if __name__=='__main__': |
| RemoveAllStaleFiles(sys.argv[1:]) |