I discovered python 6 months ago but I never got used to it really leaning.
I would like to create a python script that identifies whether it is on USB media (key) or on a computer (hard drive or SSD). I tried several techniques, with the os extension in particular. I never succeeded (however, I managed to identify the operating system, which was a small victory ).
My goal is the following: to succeed in creating a script which, if it is plugged from a USB key onto a computer and executed on it, does not launch, but if it is placed in the computerās directory then launched, then there he can execute.
Do you have a tutorial on hand explaining how to do it, or even a ready-made script?
Otherwise, if of course the logic of this forum is not to do the work in place of the requesters (which I understand - on my Arduino forum, thatās itā¦), tell me some avenues to follow to achieve my goals.
Thank you beforehand
[Edited per userās request to remove personal information ā @CAM-Gerlach]
Bonjour Mr.Elliot lol⦠nywy just kidding
You can think of checking the āabsolute pathsā which you have said you have tried and you could identify the OS⦠An overview in windows OS is to check how the path starts like C:/ drive just shows this is a hard drive unless you have partitioned and assigned drive letters to the partition we can assume any other absolute path starting with a different drive letter is an external device⦠just a thought.
if you are using Linux then check the mounted devices directory if there is a mounted device⦠check this also https://www.unix.com/shell-programming-and-scripting/104737-bash-script-detect-list-usb-flash-drives.html
I had already thought about looking at absolute paths, but I want the script to work on all operating systems. So I abandoned this idea, due to lack of knowledge to code a script with this multi-platform techniqueā¦
But the way you do it, it seems less complex to implement, so Iām going to tackle it. THANKS
Also thank you for the link provided, Iāll take a look at that
Good day
[Edited per userās request to remove personal information ā@CAM-Gerlach]