04-05-2025, 07:03 AM
(This post was last modified: 04-07-2025, 09:07 AM by hsiangch_ong.
Edit Reason: forgot user home directory in path
)
edit: i am sorry for misleading enough people with this post. before it was changed. the name of the user's home directory has to be included right after "/media/". without double-quotation marks. it was not in this post before it was edited.
probably you already know this. but if all you want to do is access files from an usb flash drive or external ssd. you need to have the path beginning as follows.
on debian/ubuntu (including linux mint) it is:
on most other linux (arch/fedora/slackware etc.) it is:
the user (without parenthesis) is the name of your home directory. this is the name you use to log into linux desktop.
the volume-label of the usb disk is actually the name of the root directory. it would be a matter of using _direxists function to check for existence of /run/media/(volume-label)/. if that doesn't exist then try /media/(volume-label)/. then work your way from there to access other files on the usb device.
(actually write the volume label of the disk, not the thing starting with parenthesis as shown above. i wrote it like that because disks should have different names as volume labels. some don't have original names such as "lexar" or "sandisk" or a hexadecimal mumbo-jumbo.)
low-level usb access is hard. as one could probably tell from windows device manager and other places.
probably you already know this. but if all you want to do is access files from an usb flash drive or external ssd. you need to have the path beginning as follows.
on debian/ubuntu (including linux mint) it is:
Code: (Select All)
/media/(user)/(volume-label)/
on most other linux (arch/fedora/slackware etc.) it is:
Code: (Select All)
/run/media/(user)/(volume-label)/
the user (without parenthesis) is the name of your home directory. this is the name you use to log into linux desktop.
the volume-label of the usb disk is actually the name of the root directory. it would be a matter of using _direxists function to check for existence of /run/media/(volume-label)/. if that doesn't exist then try /media/(volume-label)/. then work your way from there to access other files on the usb device.
(actually write the volume label of the disk, not the thing starting with parenthesis as shown above. i wrote it like that because disks should have different names as volume labels. some don't have original names such as "lexar" or "sandisk" or a hexadecimal mumbo-jumbo.)
low-level usb access is hard. as one could probably tell from windows device manager and other places.