Computer

Copy only the structure of a folder, without files, in seconds

As a general rule, when we have to manage folders and their corresponding files in Windows, we use the one known as File Browser. As you already know, to access this section, for example, we can do it through the Win + E key combination. This is an element that offers us everything we need to handle our disc contents. In this way we have the possibility of deleting, copying, or moving all kinds of files and folders.

This is the way to manage the contents of our disk drives from the Windows graphical interface. The Explorer makes these tasks much easier for us, even if we are not very experienced users in these topics. But on the other hand, there are those who want to get much more performance from this type of work, or at least have greater control over the processes. Well, there is nothing better than to dip into this case of the CMD or command prompt window.

Open CMD to copy data structure

Here we can make use of a series of commands that, among many other things, will also allow us to manage the contents of our discs. At this point we will tell you that when folders are copied and pasted, all the files and subfolders that they contain are copied with them, as you may already know. In this way all the files remain in their respective subfolders, as it should be so as not to lose anything when copying or moving content.

But at the same time it may be the case that we only need what is the folder structure. That is, we can find that we do not need to copy the files contained, but we only need to replicate the folder structure. This is something we can do manually, but as the number of folders and subfolders is very high, the task can be somewhat annoying. Thus, to avoid having to create them manually one by one, we can use the command called Xcopy.

We use this from the aforementioned CMD or command prompt window. To open this we just have to type CMD in the Windows search box. In the entry that appears we click with the right mouse button to execute this with administrator permissions.

open cmd

What is the Xcopy command that we execute in CMD

We have already commented to you before that in the case that we only need to copy a certain folder structure, we will use the Xcopy command. First of all we will tell you that Xcopy is a utility that is available by default on the system Windows 10, So we do not have to install anything additionally on the computer. Thus, we have the possibility to use this method immediately to copy and paste a folder structure whenever we need it.

It is worth mentioning at this point that with all this we can replicate the structure in any disk location. Serve as an example that if the main folder is on the Windows desktop, we can copy it and all its subdirectories to an external drive. We can do the same to a different folder or to another internal drive other than C. This is something we will do with the mentioned command command Xcopy, let’s see how.

Copy a folder structure in Windows

For all this that we tell you, the first thing we will do is move the folder whose structure we want to replicate, to a new folder that has nothing. Next we open a Command Prompt window as we showed you previously. Although at first for these tasks that concern us now we do not need administrator permissions, these will not hurt either.

Thus, to copy a folder structure As we have mentioned, without including the contained files, let’s see how to use the Xcopy command. At this point we will tell you that the syntax that we are going to use here is the following:

Xcopy "Ruta a la carpeta origen" "Ruta a la carpeta de destino" /T /E

To give us a clearer idea of ​​what we are going to have to type, let’s see a demonstrative example of the use of Xcopy:

XCOPY C:/Users/Default/Carpeta de pruebas D:/Pruebas /T /E

Here what we must know is that the first disk path is the location where we have placed the folder from which we want to copy the structure. The second path is the path we want to copy it to, which is the root of drive D, for example.

Xcopy command parameters

Once we know how to use the Xcopy command to copy just the structure of a specific folder, let’s see how we do it. Saying that the / T parameter is actually telling Xcopy to only copy the folder structure and not the files it contains.

On the other hand / E tells Xcopy to also include the subfolders that are empty to use the entire structure, which is what we are interested in here. Of course we have the possibility to execute the command without / E. In this case and the copied folder structure will include only the folders that have files inside.

xcopy command

It should also be mentioned that at the same time Xcopy is a very powerful function of the system that has a multitude of parameters to use. And it is that it will not only help us to copy folders, but it goes much further. What makes it a bit awkward to use is that it is a command line tool and there is no Graphic interface user name for her.

Similarly, if you are not a user too accustomed to using the Command Prompt, it is advisable to do tests before with unimportant folders. This way we ensure that we will make correct use of the Xcopy command when we really need it.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *