{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.14","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":21755,"databundleVersionId":1475600,"sourceType":"competition"},{"sourceId":10175795,"sourceType":"datasetVersion","datasetId":6285191}],"dockerImageVersionId":30804,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import os\nimport zipfile\n\n# Define the path to your images directory in the Kaggle input directory\ninput_images_path = '/kaggle/input/d/asma130/images-zip'  # Replace 'images-zip' with your dataset name\n# Define the path where you want to save the zip file in the working directory\nworking_zip_path = '/kaggle/working/images.zip'\n\n# Ensure the input images directory exists\nif not os.path.exists(input_images_path):\n    print(f\"Input images directory not found at {input_images_path}\")\nelse:\n    # Create a ZipFile object and add images\n    with zipfile.ZipFile(working_zip_path, 'w') as zipf:\n        for root, dirs, files in os.walk(input_images_path):\n            for file in files:\n                file_path = os.path.join(root, file)\n                # Add file to the zip archive\n                zipf.write(file_path, arcname=os.path.relpath(file_path, input_images_path))\n\n    print(f\"Created zip file at {working_zip_path}\")\n\n# Now you can proceed with any operations on images.zip in the working directory\n# For example, list the contents of the working directory\nprint(\"Contents of /kaggle/working\")\nprint(os.listdir('/kaggle/working'))","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true,"execution":{"iopub.status.busy":"2024-12-12T03:21:32.344554Z","iopub.execute_input":"2024-12-12T03:21:32.345314Z","iopub.status.idle":"2024-12-12T03:22:25.649631Z","shell.execute_reply.started":"2024-12-12T03:21:32.345277Z","shell.execute_reply":"2024-12-12T03:22:25.648637Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null}]}