Original code copyright (C) 2009-2022 Rudolf Cardinal (firstname.lastname@example.org).
This file is part of cardinal_pythonlib.
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Tool to scan rescued Microsoft Office OpenXML files (produced by the “find_recovered_openxml.py” tool in this kit; q.v.) and detect bad (corrupted) ones.
gen_from_stdin() → Generator[str, None, None]¶
Yields stripped lines from stdin.
is_openxml_good(filename: str) → bool¶
Determines whether an OpenXML file appears to be good (not corrupted).
main() → None¶
Command-line handler for the
find_bad_openxmltool. Use the
--helpoption for help.
process_openxml_file(filename: str, print_good: bool, delete_if_bad: bool) → None¶
Prints the filename of, or deletes, an OpenXML file depending on whether it is corrupt or not.
- filename – filename to check
- print_good – if
True, then prints the filename if the file appears good.
- delete_if_bad – if
True, then deletes the file if the file appears corrupt.