user1411084
user1411084

Reputation: 512

Detect Folders Created by Apps

Is there any way to detect whether a folder was created by an Android app, and not by the user?

Upvotes: 0

Views: 1255

Answers (1)

Marcin Orlowski
Marcin Orlowski

Reputation: 75629

No. There's no such information stored in file system (nor in android nor in Linux in general). And even if it would, from filesystem perspective user never creates anything. It is always the app (and it's not important if app does it by itself or directed by user). App just tells the OS "create that folder for me", w/o giving any more detailed information why it wants that to be done and who is the real culprit.

EDIT: I just realised there's a case which maybe was on OP's mind - SD card. Content there can be created "by user" (which means when it got card mounted and accessed i.e. from desktop) and not by android application. But finding that out could be tricky. Some below suggest FileObserver. I am not sure. I'd maybe try to monitor mount/unmount broadcasts, then perhaps scan the sd card to see if there's anything added after unmount. But it is rather ineffective too, as if it is real sd card and user put it in machine with wrong clock, then my scan won't find much there. Other attempt is to know what is there (so build a "map" of sdcard once you see it for the first time and then compare with subsequent mounts). Still, the question remains - why you need that for? Maybe there's simplier approach to your problem

Upvotes: 1

Related Questions