MacOS – Folder changed into document

foldersmacos

A folder and all it's contents have changed into an extensionless document. When I open the file in Sublime Text I get 100,000+ lines of text like: 0403 0000 46aa ee00 0000 0000 1800 0000. This is on an HFS+ boot volume.

Google Drive shows the history of this as being a document as of the initial upload. So it should be ruled out as the culprit.

My Time Machine backup on a Time Capsule only goes back to the beginning of August, which shows the folder as a file.

How do I change this document back into a folder?


cd <folder> returns Not a directory

stat <folder> returns 16777218 1139857 -rw------- 1 <my username> <company name>\Domain Users 0 1800948 "Aug 21 09:11:51 2014" "Apr 16 11:04:43 2014" "May 1 14:00:13 2014" "Apr 16 11:04:43 2014" 4096 3520 0 <folder>

tar -xzf <folder> returns

tar: Unrecognized archive format
tar: Error exit delayed from previous errors.

Best Answer

There are a bunch of posts online from users who have run into this issue. All of them end with the same answer: "I hope you have a backup."

I have spoken to multiple people who have worked with Unix/Linux for a long, long time. The general consensus is that

  1. there is no way to just "turn a folder into a file"
  2. there is no recovering from whatever you have done without restoring the directory from a backup

They believe that some application has deleted the directory unintentionally and replaced it with a file. I have looked online for a way to manually set the d bit of the file you are speaking of but there seems to be no way of achieving this.

So, my answer is to restore the directory from a Time Machine backup (you hinted that you already had a backup - use it).

Related Question