Files
create/src/Tools/catfiles.py
ᴩʜᴏɴᴇᴅʀᴏɪᴅ 546a43b8b8 Removed outdated UTF8 declaration [ Other ] (#24528)
* Removed outdated UTF8 declaration

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-10-13 18:34:43 +02:00

43 lines
992 B
Python

#! python
# (c) 2018 Werner Mayer LGPL
#
import sys, getopt
# import os # The code that needs this is commented out
import shutil
def main():
outputfile = ""
try:
opts, args = getopt.getopt(sys.argv[1:], "o:", ["outputfile="])
except getopt.GetoptError:
pass
for o, a in opts:
if o in ("-o", "--outputfile"):
outputfile = a
# if os.path.exists(outputfile):
# do_not_create = True
# ts = os.path.getmtime(outputfile)
# for f in args:
# if os.path.getmtime(f) > ts:
# do_not_create = False
# break
#
# if do_not_create:
# print ("Up-to-date file {0}".format(outputfile))
# return
with open(outputfile, "wb") as wfd:
for f in args:
with open(f, "rb") as fd:
shutil.copyfileobj(fd, wfd, 1024 * 1024 * 10)
print("Created file {0}".format(outputfile))
if __name__ == "__main__":
main()