In JB, they changed the mount point for external storage to 
/storage/sdcard0.  At least this is the case for the Galaxy Nexus and Nexus 
7.  So if you're not seeing the directory, double check it.  Still, 
/mnt/sdcard should be a symlink to /storage/sdcard0.

I'm noticing that you're taking the file object from 
Environment.getExternalStorageDirectory, then turning that into a string, 
then turning it into a File again.  That's not necessarily wrong, but you 
might want to reconsider that.

Doug

On Wednesday, July 25, 2012 9:43:07 AM UTC-7, Alessandro Pellizzari wrote:
>
> Hi all, 
>
> I am having problems scanning my files on the root of the sdcard, but (it 
> appears) only on 4.1. 
>
> This is my code: 
>
> public static void scanAll(NotifyScan target) 
> { 
>  String source = 
>   Environment.getExternalStorageDirectory().getAbsolutePath() 
>  ; 
>
>  Log.d("SCANDIR", source); 
>   
>  scanDir(new File(source)); 
> } 
>
> private void scanDir(File path) 
> { 
>   for ( File f:path.listFiles() ) { 
>     Log.d("SCAN", f.getAbsolutePath()); 
>   } 
> } 
>
> I removed error catching for clarity. 
> The output is: 
>
> SCANDIR /mnt/sdcard 
> SCAN /mnt/sdcard/LOST.DIR 
> SCAN /mnt/sdcard/.android-secure 
>
> But from the File Explorer in DDMS and from adb shell, I get: 
>
> # ls -la /mnt/sdcard 
> d--------- root     root              2012-07-16 11:42 .android_secure 
> d---rwxr-x system   sdcard_rw          2012-07-16 11:42 Alarms 
> d---rwxr-x system   sdcard_rw          2012-07-16 17:06 MyDirectory 
> d---rwxr-x system   sdcard_rw          2012-07-16 11:42 DCIM 
> d---rwxr-x system   sdcard_rw          2012-07-16 11:42 Download 
> d---rwxr-x system   sdcard_rw          2012-07-16 11:42 LOST.DIR 
> d---rwxr-x system   sdcard_rw          2012-07-16 11:42 Movies 
> d---rwxr-x system   sdcard_rw          2012-07-16 11:42 Music 
> d---rwxr-x system   sdcard_rw          2012-07-16 11:42 Notifications 
> d---rwxr-x system   sdcard_rw          2012-07-16 11:42 Pictures 
> d---rwxr-x system   sdcard_rw          2012-07-16 11:42 Podcasts 
> d---rwxr-x system   sdcard_rw          2012-07-16 11:42 Ringtones 
>
> I need to scan every directory on the sdcard and find a certain type of 
> file. It all worked fine in 2.2 and 2.3. 
>
> What can I do? 
>
> Thank you very much. 
>
> Bye. 
>
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to