Skip to content

Commit 341ea73

Browse files
author
Massimiliano Lupo Pasini
committed
updated download script to move tar files into subdirectories
1 parent c54fc1b commit 341ea73

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

examples/omat24/download_dataset.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,17 @@ def get_data(datadir, task, split):
5252
), f'{task}/{split}" split not defined, please specify one of the following: {list(DOWNLOAD_LINKS[task].keys())}'
5353
download_link = DOWNLOAD_LINKS[task][split]
5454

55+
os.makedirs(os.path.join(datadir, task), exist_ok=True)
56+
5557
os.system(f"wget {download_link} -P {datadir}")
5658
filename = os.path.join(datadir, os.path.basename(download_link))
57-
logging.info("Extracting contents...")
58-
os.system(f"tar -xvf {filename} -C {datadir}")
59-
filename_without_extension = filename.replace(".tar.gz", "")
60-
os.makedirs(os.path.join(datadir, task), exist_ok=True)
6159

6260
# Move the directory
63-
shutil.move(filename_without_extension, os.path.join(datadir, task))
61+
new_filename = os.path.join(datadir, task, os.path.basename(download_link))
62+
shutil.move(filename, new_filename)
63+
64+
logging.info("Extracting contents...")
65+
os.system(f"tar -xvf {new_filename} -C {os.path.join(datadir, task)}")
6466

6567

6668
if __name__ == "__main__":

0 commit comments

Comments
 (0)