Search code examples
androidadbandroid-external-storage

Moved mp3 files from internal to external storage. Files are not recognized anymore


To clear up some disk space I moved my mp3 collection from internal to external storage. My device is rooted and I was su at the time.

The files can be seen (and played) from the File Manager, but none of my music players see them.

What looked interesting was the file permissions after moving. Here's a file still on internal storage that wasn't moved.

root@kltetmo:/data/media/0/Download/mp3 # ll
-rw-rw-r--    1 1023     1023       6730901 Aug 25 16:03 fatamix_upd_start_20160824(2).mp3
root@kltetmo:/data/media/0/Download/mp3 # 

enter image description here

And here are a couple files that were moved to external storage:

root@kltetmo:/storage/sdcard1/Music/Bat for Lashes/Fur and Gold # ll                                   
-rwxrwx---    1 root     1028       5887321 Jul 16  2015 01 - Horse And I.mp3
-rwxrwx---    1 root     1028       5894753 Jul 16  2015 04 - What's A Girl To Do_.mp3

enter image description here

Moving them to external storage appears to have changed permissions. Unfortunately, chmod is not affecting the actual file permissions:

root@kltetmo:/storage/sdcard1/Music/Bat for Lashes/Fur and Gold # ll
-rwxrwx---    1 root     1028       5887321 Jul 16  2015 01 - Horse And I.mp3
-rwxrwx---    1 root     1028       5894753 Jul 16  2015 04 - What's A Girl To Do_.mp3
root@kltetmo:/storage/sdcard1/Music/Bat for Lashes/Fur and Gold # chmod 664 01\ -\ Horse\ And\ I.mp3   
root@kltetmo:/storage/sdcard1/Music/Bat for Lashes/Fur and Gold # ll                                   
-rwxrwx---    1 root     1028       5887321 Jul 16  2015 01 - Horse And I.mp3
-rwxrwx---    1 root     1028       5894753 Jul 16  2015 04 - What's A Girl To Do_.mp3

I tried moving the file back to internal storage to change permissions there. This worked until I moved the file back to external storage.. moving it definitely changed permissions to 770.

root@kltetmo:/data/media/0/Music # ll
-rwxrwx---    1 root     1028       5887321 Nov 14 18:18 batforlashes.mp3
root@kltetmo:/data/media/0/Music # chmod 644 batforlashes.mp3                                          
root@kltetmo:/data/media/0/Music # ll
-rw-r--r--    1 root     1028       5887321 Nov 14 18:18 batforlashes.mp3
root@kltetmo:/data/media/0/Music # mv batforlashes.mp3 /storage/sd                                     
sdcard0/ sdcard1/ 
forlashes.mp3 /storage/sdcard1/Music/Bat\ for\ Lashes/Fur\ and\ Gold/                                 <
root@kltetmo:/data/media/0/Music # ll
root@kltetmo:/data/media/0/Music # ll /storage/sdcard1/Music/Bat\ for\ Lashes/Fur\ and\ Gold/          
-rwxrwx---    1 root     1028       5887321 Jul 16  2015 01 - Horse And I.mp3
-rwxrwx---    1 root     1028       5894753 Jul 16  2015 04 - What's A Girl To Do_.mp3
-rwxrwx---    1 root     1028       5887321 Nov 14 18:18 batforlashes.mp3
root@kltetmo:/data/media/0/Music # 

What do I need to do to reset permissions so these files can be seen and played from my default music app?


Solution

  • Android media player apps do not scan the file system to get the list of available media files - they get the list from an internal database. You need to send the ACTION_MEDIA_SCANNER_SCAN_FILE intent to force rescan of the folder where the files were moved to for them to become visible to the player apps.