spinalcordtoolbox icon indicating copy to clipboard operation
spinalcordtoolbox copied to clipboard

`sct_download_data` deletes the contents of the output folder by default, which is dangerous when combined with `-o`

Open joshuacwnewton opened this issue 1 year ago • 3 comments

I wanted to download sct_example_data to my PWD, so I ran:

sct_download_data -d sct_example_data -o .

Which then proceeded to irreversibly delete everything in my PWD. :facepalm:

I should have used one of the two following syntaxes:

sct_download_data -d sct_example_data -o sct_example_data/
sct_download_data -d sct_example_data -o ./sct_example_data/

But we should maybe be a little more careful when running commands that delete everything within a directory, aha.

joshuacwnewton avatar Jun 19 '24 18:06 joshuacwnewton

Yikes, that's a big issue yes!

mguaypaq avatar Jun 19 '24 18:06 mguaypaq

oh gosh, good thing you tested this @joshuacwnewton (hopefully you were not at ~/ 😅 )

jcohenadad avatar Jun 19 '24 18:06 jcohenadad

Thankfully I was just in ~/data (which is a folder I created in response to... ALSO deleting the data/ folder just a few days ago).

Because I had deleted everything once already, I was mostly starting fresh, so not much else was deleted. :laughing:

joshuacwnewton avatar Jun 19 '24 18:06 joshuacwnewton

Closing this issue as a duplicate of #4562.

joshuacwnewton avatar Jul 18 '24 13:07 joshuacwnewton