Analyze multiple extensionless files, detect their (different) extensions, AND add correct extension

Discussion in 'Windows Multimedia' started by ErrorAddict, Mar 17, 2017.

  1. ErrorAddict

    Joined:
    Mar 17, 2017
    Messages:
    1
    Likes Received:
    0
    Hello everyone!

    I have a bit of a unique issue. I have a rather large library of media files of many different types. JPEG, GIFF, MP3, ACC, AVI, MPEG, MP4 ect...

    Most of the files have an incorrect extension, or no extension at all. This is entirely my fault as my fix for not enabling certain files to be detected by media library applications was to remove the extension. Then later if I wanted them to be detected I would just add a generic file extension to them. MP4 if it was video, MP3 if it was music, and JPEG if it was a photo. This method of lying to my computer has worked well for years, and it still does, accept now I want to divorce myself from folders and use tags to organize my files and I am stuck with a problem.

    I can only put tags on a very few of my files, maybe they're the ones labeled correctly?

    Right now the bleak future I see ahead of me is manually detecting the file type of each file, then manually renaming it. With work schedule and library size the way they are I would be lucky to finish while still in amongst the living. If that's my only option there would be nothing to do except make myself believe that tags were never all that great to begin with.

    Finally my question:
    Is there a way to batch detect file types for directories of mixed file-type files? Does that make sense? If I have 1000 files that are LABELED as mp4's or extensionless, but there are ACTUALLY at least 5 different types is there a single batch process that can detect all the file types at once? I'm assuming It would then need to be able to either correct them by itself or separate them into different directories to have been of use to me.

    Sorry if that sounds confusing.

    I hope I can fix this becuase just as spouses sometimes regret their marriage with their partners, I too put the ring on without thinking, and now find myself despising that controlling and restrictive partner I'm stuck with.
     
  2. Neemobeer

    Neemobeer Windows Forum Team
    Staff Member

    Joined:
    Jul 4, 2015
    Messages:
    2,845
    Likes Received:
    437
    Pretty easy to do with powershell.
    • Read first line from each file, max the file signature to the file type
    • Have some logic to see if the file has an extension or file list
    • Remove old extension if needed and add correct extension
    I could put something together when I get home if you want.
     

Share This Page

Loading...