{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n#     for filename in filenames:\n    print(os.path.join(dirname))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"files = \"/kaggle/input/imagenet-object-localization-challenge/ILSVRC/Annotations/CLS-LOC/train/n07614500\"","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!ls","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print('tes')","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import os\nimport subprocess\nfrom IPython.display import FileLink, display\n\ndef download_file(path, download_file_name):\n    os.chdir('/kaggle/working/')\n    zip_name = f\"/kaggle/working/{download_file_name}.zip\"\n    command = f\"zip {zip_name} {path} -r\"\n    result = subprocess.run(command, shell=True, capture_output=True, text=True)\n    if result.returncode != 0:\n        print(\"Unable to run zip command!\")\n        print(result.stderr)\n        return\n    display(FileLink(f'{download_file_name}.zip'))","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def download_files(download_file_name):\n    os.chdir('/kaggle/working/')\n    files_list = []\n    for name in download_file_name:\n        for folder in ['Data','Annotations']:\n            files_list.append(\"/kaggle/input/imagenet-object-localization-challenge/ILSVRC/{}/CLS-LOC/train/{}\".format(folder,name))\n    files_list = \" \".join(files_list)\n#     print(files_list)\n    command = f\"zip /kaggle/working/testing.zip {files_list} -r\"\n    result = subprocess.run(command, shell=True, capture_output=True, text=True)\n    if result.returncode != 0:\n        print(\"Unable to run zip command!\")\n        print(result.stderr)\n        return\n    display(FileLink('testing.zip'))\n#     return files_list\n#     return command\n#     result = subprocess.run(command, shell=True, capture_output=True, text=True)\n","metadata":{"execution":{"iopub.status.busy":"2023-06-01T09:53:46.123483Z","iopub.execute_input":"2023-06-01T09:53:46.124198Z","iopub.status.idle":"2023-06-01T09:53:46.131839Z","shell.execute_reply.started":"2023-06-01T09:53:46.124165Z","shell.execute_reply":"2023-06-01T09:53:46.130717Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"download_files(['n07613480','n07614500','n07615774','n07693725','n07695742','n07697313','n07697537', 'n07711569','n07714571','n07714990','n07715103','n07720875','n07734744','n07745940','n07747607','n07749582','n07753275','n07753592','n07754684','n07760859','n07831146','n07873807','n12144580'])","metadata":{"execution":{"iopub.status.busy":"2023-06-01T09:53:48.170679Z","iopub.execute_input":"2023-06-01T09:53:48.171066Z","iopub.status.idle":"2023-06-01T10:02:33.724323Z","shell.execute_reply.started":"2023-06-01T09:53:48.171035Z","shell.execute_reply":"2023-06-01T10:02:33.722549Z"},"trusted":true},"execution_count":null,"outputs":[]}]}