jerickson314 / sdscanner

SD Scanner: An app to force Android to rescan a storage medium. Uses a method compatible with 4.4.
GNU General Public License v2.0
48 stars 11 forks source link

After using sdscanner, new folders show up as files #11

Open Gitoffthelawn opened 9 years ago

Gitoffthelawn commented 9 years ago

After using sdscanner, new folders show up as files (4K in size) on the Windows 7 SP1 PC connected to the Android KitKat device via MTP.

Performing an internet search reveals a Ubuntu user having similar issues as well as this person on XDA: http://forum.xda-developers.com/showthread.php?t=2670759

jerickson314 commented 9 years ago

What version were you running? I've seen this issue before, which is why 1.11 is supposed to simply ignore a folder with no contents. (I'm just running the normal media scanner API to inform Android about a "new" file/folder, but it does what you describe when run on an empty folder.) Are these folders that actually contain at least one file, in which case it would be something I haven't seen before? Or is the check I'm doing in 1.11 not working in all cases?

From what I've seen, if you've run a version of SD Scanner prior to 1.11, you may still have these folders showing up as files that are still present. A rename or delete dance might fix any given case.

The XDA thread you posted is from before I implemented the workaround.

Gitoffthelawn commented 9 years ago

Definitely version 1.11. Never used a prior version, if that helps.

Folders had other files in them, but no media files. One folder only had only .txt files in it. Another had a .csv file and a sub-folder with a .txt file in it. Both folders were represented as files instead of as folders after running sdscanner. I believe both were created after the phone was last rebooted (and a good chance after Android's media scan was last automatically run).

jerickson314 commented 9 years ago

That's useful to know, and thanks for reporting this. It appears that whether the folder has media files, rather than whether it has files in the first place, is what determines whether the problematic behavior happens.

I'll do some experimenting. It might be the case that if I never call the scanner on directories, this might not happen. But scanning directories might be how deleted files get detected. I'll see if there's a good workaround.

Gitoffthelawn commented 9 years ago

Sounds great. Fortunately, deleting the cache and data for the Media Scanner seems to work effectively to reset it.

I like your different strategies, and I'm guessing one of them will work to solve the problem.

Shouldn't sdscanner work to show all files, even .txt and .csv files?