Hi Guys,
I'm trying to open a USB drive on Kubuntu to write to, but clearly I need to find out which drives are available first. The following code works fine after the drives have been examined using dolphin or whatever, but otherwise not. So I can plug in a USB drive and run the code and I get negative results. If I then inspect a drive with dolphin and run the code, the drive is detected. I guess I need to mount the drive somehow, but how?
Advice welcome.
Code follows.
Thanks
Steve
use strict; use warnings; package dir_test; for (my $i=0;$i<=5;$i++){ if ($i==0 and opendir (MYDIR, "/media/disk/.")){ print "/media/disk/","\n"; closedir (MYDIR); } else { if ($i>0 and opendir (MYDIR, "/media/disk-$i/.")){ print "/media/disk-$i/","\n"; closedir (MYDIR); } else { print "not /media/disk-$i/","\n"; } } }
In reply to Opening a USB drive for storing info. by Steve_BZ
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |