From 7bef1693e59833d6c5d7a128d25dbaecc49a1a15 Mon Sep 17 00:00:00 2001 From: Preciado12Caesar Date: Fri, 11 Jul 2025 23:43:23 -0500 Subject: [PATCH] --only option to extract files by extension --- rpatool | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rpatool b/rpatool index 58b2f8d..5e11d9e 100755 --- a/rpatool +++ b/rpatool @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 + #!/usr/bin/env python3 from __future__ import print_function @@ -323,6 +323,7 @@ if __name__ == "__main__": parser.add_argument('-l', '--list', action='store_true', help='List files in archive ARCHIVE.') parser.add_argument('-x', '--extract', action='store_true', help='Extract FILEs from ARCHIVE.') + parser.add_argument('--only', metavar='EXT', help='Optional: extract only files with this extension (e.g., .png)') parser.add_argument('-c', '--create', action='store_true', help='Creative ARCHIVE from FILEs.') parser.add_argument('-d', '--delete', action='store_true', help='Delete FILEs from ARCHIVE.') parser.add_argument('-a', '--append', action='store_true', help='Append FILEs to ARCHIVE.') @@ -433,6 +434,11 @@ if __name__ == "__main__": files = arguments.files else: files = archive.list() + + # optional filter --only + if arguments.only: + files = [f for f in files if f.lower().endswith(arguments.only.lower())] + # Create output directory if not present. if not os.path.exists(output):