android – Images with :nopm: in filename-ThrowExceptions

Exception or error:

I’v recently discovered that images taken with Google Hangouts sometimes add a :nopm: to the end of the filename. For example, DCIM/Camera/IMG_20141212_123123:nopm:.jpg

This is causing me a ton of parsing issues. One of the biggest being that when I created a File object out of this path, and try file.exists(), I GET A FALSE!!!!!

My end goal for this is that when I run into one of these :nopm: images, I’d like to just rename it on the device and continue my processing as normal.

Here’s my code:

public static void checkForNopm(File file) {

    final String path = file.getPath();

    if (path.contains(":nopm:")) {
        final File newfile = new File(file.getPath().replace(":nopm:",""));
        file.renameTo(newfile);
    }
}
How to solve:

Read this:

https://android.stackexchange.com/questions/98266/why-is-there-nopm-in-some-photo-file-names

No solution also. But possibly it is a way for Google Hangout to escape the photo from being managed by other utilities. I search for :nopm: when I was trying to copy some photo I took when playing Ingress and shared with Google Hangout. I came to your question, and then that answer in android listed the second. I believe the answer of “No Photo Manager” is more reasonable than “AM/PM”.

If this is really the case, the best method will be manually removing those “:nopm:” before you can manage them by tools. But at the same time, other tools like “Dropbox” can backup these photos as well.

###

Its look like 12-hours clock pm/am. The hour in the photo is 12:31:23, and :nopm: can mean no pm (so, am) or that is configured in other type like 24-hour.

Have you tried to check if hour in photos without :nopm: is over 12:00 am?

Leave a Reply

Your email address will not be published. Required fields are marked *