There's no way I know of to change a between a "normal" file and a directory type file. That concept goes to the lowest levels of a Unix kernel. There's no system call to change the type once a file is created. The only way that could happen in a local file system is with file system corruption. I would like to hear why you think a file type changed and how that might of happened. Is this on a network drive? On an external drive? Or your internal storage?
As a double-check, you can enter a couple Terminal shell commands to verify the actual type of a file. The flag that indicates that a file is a directory is embedded in the "mode" of the file. The mode also contains the Unix file permissions. The command "stat" in the shell can give you those details at a low level.
Open the Terminal program.
Type the command "stat", add a space after it, then Drag a file into the Terminal Window. That will add the path to the file. Then hit Return.
Same thing, but use the command "stat -r" then a space, the drag the file. Hit Return.
Here is an example of a "normal" file. The "mode" is the third field.
Code:
rmbp13:~$ stat /Users/xxxx/Documents/apfs-commands.txt
16777220 10259022 -rw-r--r-- 1 xxxx staff 0 668 "Sep 20 14:34:38 2016" "Sep 20 14:34:38 2016" "Sep 20 14:34:38 2016" "Sep 20 14:34:38 2016" 4194304 8 0 /Users/xxxx/Documents/apfs-commands.txt
rmbp13:~$ stat -r /Users/xxxx/Documents/apfs-commands.txt
16777220 10259022 0100644 1 501 20 0 668 1474407278 1474407278 1474407278 1474407278 4194304 8 0 /Users/xxxx/Documents/apfs-commands.txt
The third field says "-rw-r--r--" corresponds to 0100644. The second digit is "1" that indicated normal file.
Here's a directory:
Code:
rmbp13:~$ stat /Users/xxxx/Documents/Base\ Station\ Configs
16777220 437339 drwxr-xr-x 4 xxxx staff 0 128 "Jan 25 17:48:10 2018" "Oct 18 16:26:54 2009" "Dec 17 22:10:06 2015" "Oct 18 16:26:54 2009" 4194304 0 0 /Users/xxxx/Documents/Base Station Configs
rmbp13:~$ stat -r /Users/xxxx/Documents/Base\ Station\ Configs
16777220 437339 040755 4 501 20 0 128 1516931290 1255908414 1450419006 1255908414 4194304 0 0 /Users/xxxx/Documents/Base Station Configs
The third field says "drwxr-xr-x" corresponds to 040755. The second digit "4" means directory.
What values do you get for your file? Either way, if you think a directory disappeared, you should do a file system check. It will be able to find "missing" files from a corrupted directory.