Solved Turning a file into a folder with CMD/Batch file

May 12, 2014 at 04:26:06
Specs: Windows 7 Professional, 3.6GHz 16GB
I know it is possible to copy a file into another file by using xcopy

xcopy "file.stuff" "anotherFile.something"

Is it possible to replace the first file with a folder? In other words, turn a folder into a file/copy a folder into a file? Xcopy nor copy won't do it for me.

If infinity is infinite, is the square root of infinity infinite as well?
- Kurp Von Steiner

message edited by RainBawZ

See More: Turning a file into a folder with CMD/Batch file

Report •

May 12, 2014 at 05:18:23
What you are asking is a nonsense, because a folder and a file are different entities.

- A Folder is a collection of files
-A File contains some kind of information.

So you can't turn a dog into a cat. By the way xcopy copies the contents of a folder into another folder while copy copies the content of a file into another file (to know more at prompt type xcopy /? or copy /?).

Report •

May 12, 2014 at 19:32:33
✔ Best Answer
I kinda had that same idea about 20 years ago, when DOS was still in control. "Since a file entry is just a pointer to a location on disk, why not make a file entry that points to a directory root?". I tried it but didn't get it to work. As IVO said, dogs and cats can't breed. If you were sneaky and slippery enough, you might figure out a way to change the attributes of the directory to those of a file, there-by creating a "ghost directory". But with Windows security and protection... good luck. Your only other option that I know is to PKZIP (archive etc) the directory into a file, (you don't even have to compress it), but I'm not sure what that would accomplish.

Report •

May 13, 2014 at 09:29:46
In the proud tradition of me being too lazy to actually provide code, I shall provide the the following hint.

Folders are a product of of Explorer, and not necessarily representative of a drive's directory structure. There are folders without directories, and directories without folders.

How To Ask Questions The Smart Way

Report •

Related Solutions

Ask Question