I have thousands of files without extensions after recovery (mostly pictures). I need to sort them into separate folders by filetype (folders must be created during sort process). I can determine filetype in linux using “file” command. Does somebody have bash script for it? For example: Initial dir contains files: 001, 002, 003, 004. After sorting should be 3 dirs: