View other drives

Post your Gambas programming questions here.
User avatar
cogier
Site Admin
Posts: 1197
Joined: Wed Sep 21, 2016 2:22 pm
Location: Guernsey, Channel Islands

View other drives

Post by cogier »

I want to look at the files on my phone, but I can't see how to view any other drives but the main one. Am I missing something?
BruceSteers
Legend
Posts: 2110
Joined: Thu Jul 23, 2020 5:20 pm
Location: Isle of Wight

Re: View other drives

Post by BruceSteers »

What with ?

FileChooser.class ?

Did you set FileChooser.Root to "/" or to a folder?

If .Root property is / you should be able to see everything the system can.

If .Root property is set to a folder you can only see from that folder.

Maybe it's that?
User avatar
cogier
Site Admin
Posts: 1197
Joined: Wed Sep 21, 2016 2:22 pm
Location: Guernsey, Channel Islands

Re: View other drives

Post by cogier »

Good point, I had not thought of that, but it still doesn't work for me.

Image
BruceSteers
Legend
Posts: 2110
Joined: Thu Jul 23, 2020 5:20 pm
Location: Isle of Wight

Re: View other drives

Post by BruceSteers »

is it in the media folder?


Dim sPath As String = "/run/media" &/ User.Name  ' Os's like Fedora use /run/media
If Not Exist(sPath) Then sPath = "/media" &/ User.Name  ' others use /media

FileChooser1.Root = sPath

User avatar
Quincunxian
Regular
Posts: 199
Joined: Sun Jun 25, 2017 12:14 am
Location: Western Australia
Contact:

Re: View other drives

Post by Quincunxian »

I'm on Mint so may be different but:
/dev/disk/by-label
gets me all the installed disks I have with their label apart from the primary drive.
Cheers - Quin.
I code therefore I am
User avatar
cogier
Site Admin
Posts: 1197
Joined: Wed Sep 21, 2016 2:22 pm
Location: Guernsey, Channel Islands

Re: View other drives

Post by cogier »

Thanks guys but no joy. I can't find the directories "/run/media" or "/dev/disk/by-label" and "/media" &/ "User.Name" is empty. I am using Mint 22 and I think the files are in "/dev/disk/by-id", see list below (my phone is not listed!), but I can't read them and, looking at the file names, there seems to be a lot of duplication. I've done some searching, but I am unable to find a command that will give me a simple list of devices with their names. Then, how to access a drive? I didn't think it was going to be this complicated. :cry:

/dev/disk/by-id/ata-Hitachi_HDT721010SLA360_STF607MS1R9MEK
/dev/disk/by-id/ata-Hitachi_HDT721010SLA360_STF607MS1R9MEK-part1
/dev/disk/by-id/ata-Hitachi_HDT721010SLA360_STF607MS1R9MEK-part2
/dev/disk/by-id/ata-Hitachi_HDT721010SLA360_STF607MS1R9MEK-part3
/dev/disk/by-id/ata-Samsung_SSD_860_EVO_500GB_S4XBNZFN401278Y
/dev/disk/by-id/ata-Samsung_SSD_860_EVO_500GB_S4XBNZFN401278Y-part1
/dev/disk/by-id/ata-V_Series_SATA_SSD_120GB_224710893500357
/dev/disk/by-id/ata-V_Series_SATA_SSD_120GB_224710893500357-part1
/dev/disk/by-id/nvme-eui.e8238fa6bf530001001b444a4959842d
/dev/disk/by-id/nvme-eui.e8238fa6bf530001001b444a4959842d-part1
/dev/disk/by-id/nvme-WD_Blue_SN570_250GB_21353V640713
/dev/disk/by-id/nvme-WD_Blue_SN570_250GB_21353V640713_1
/dev/disk/by-id/nvme-WD_Blue_SN570_250GB_21353V640713_1-part1
/dev/disk/by-id/nvme-WD_Blue_SN570_250GB_21353V640713-part1
/dev/disk/by-id/usb-USB2.0_External_Mass_Storage_Device_0010101640100D695
/dev/disk/by-id/wwn-0x5000cca35ed83bce
/dev/disk/by-id/wwn-0x5000cca35ed83bce-part1
/dev/disk/by-id/wwn-0x5000cca35ed83bce-part2
/dev/disk/by-id/wwn-0x5000cca35ed83bce-part3
/dev/disk/by-id/wwn-0x5002538ed04ec5f5
/dev/disk/by-id/wwn-0x5002538ed04ec5f5-part1
/dev/disk/by-id/wwn-0x5000000000000000
/dev/disk/by-id/wwn-0x5000000000000000-part1
BruceSteers
Legend
Posts: 2110
Joined: Thu Jul 23, 2020 5:20 pm
Location: Isle of Wight

Re: View other drives

Post by BruceSteers »

Hmm, does your code have "User.Name" (with quotes) like your example or just User.Name

cause I'm using mint and it has always used "/media" &/ User.Name

FileChooser1.Root = "/media" &/ User.Name

what does your file browser show is in /media/ ?
BruceSteers
Legend
Posts: 2110
Joined: Thu Jul 23, 2020 5:20 pm
Location: Isle of Wight

Re: View other drives

Post by BruceSteers »

lsblk -o "MOUNTPOINT"| grep /

should list all mounted disks
User avatar
cogier
Site Admin
Posts: 1197
Joined: Wed Sep 21, 2016 2:22 pm
Location: Guernsey, Channel Islands

Re: View other drives

Post by cogier »

Hmm, does your code have "User.Name" (with quotes) like your example or just User.Name
Opps. This was a typing mistake when writing the post, the code was correct.
cause I'm using mint and it has always used "/media" &/ User.Name
I have looked at this on 2 computers, just to make sure, both running Mint 22 and this is what shows, including hidden files.

Image
what does your file browser show is in /media/ ?
Image
lsblk -o "MOUNTPOINT"| grep /

should list all mounted disks
Image

The file browser, Nemo, shows my phone's Music folder as "mtp://HMD_Global_Nokia_X30_5G_H1X9FI1AL03B0800099/Internal shared storage/Music/" (With or without %20s for spaces) but Gambas does not want to Dir() that folder either.

Image
BruceSteers
Legend
Posts: 2110
Joined: Thu Jul 23, 2020 5:20 pm
Location: Isle of Wight

Re: View other drives

Post by BruceSteers »

eew , that's wierd..

maybe like this...
$ ls /run/user/1000/gvfs/
'mtp:host=Google_Pixel_8a_43221JEKB18852'

$ ls "/run/user/1000/gvfs/mtp:host=Google_Pixel_8a_43221JEKB18852"/
'Internal shared storage'

$ ls "/run/user/1000/gvfs/mtp:host=Google_Pixel_8a_43221JEKB18852/Internal shared storage"/
 Alarms    Audiobooks   Documents   Movies  'Music (1)'    Notifications   Podcasts     Ringtones
 Android   DCIM         Download    Music    Pictures        Recordings
Post Reply