How to make an empty copy of a folder structure in Windows

I found myself needing to copy a folder structure in Windows, but I didn’t need any of the files contained within.

One way of doing this would be copying and pasting it to where I wanted, then navigating the folders and manually deleting all of the files, but the copy operation would be longer than necessary, due to it copying the contents of all of the folders & the deletion of the files after the copy would take even more time.

So, I recommend using a command line utility called xcopy.

Xcopy has been around for a very long time & is an extended version of the copy command.

So, back to it. Let’s say we want to copy the structure of FolderA including all it’s sub-folders recursively and call the copy FolderB. To do that we can fire up the command prompt or powershell and run the following command

xcopy /t /e FolderA FolderB

It will then ask if the target is a file or directory, we want to press D for our scenario.

And that’s it. We are done.

In the above command the /t means copy the directory structure without files and the /e means we want it to copy empty folders too.

If you want a complete list of switches, then you can run:

xcopy /?

Hope this helps someone. Please like & share & I look forward to reading any comments.

A simple C# JsonConverter example – bool to bit

Newtonsoft Json.NET is a great framework for serialising/de-serialising your Json with .Net, it has a good collection of default handlers for transforming data-types, but what if you would like to override the way in which a property is written/read.
In this example we will change the way that boolean properties are handled, so that they are read and written as 1 or 0 as opposed to the default “True” or “False”.

Continue reading

Splitting strings in MS Excel without regular expressions

Consider a fieldĀ in Excel that contains a number followed by a ‘\’ character, followed by 3 letters.

For example: 123456789\ABC

No let us say that you would like to get the part of the string that exists before or after the ‘\’ character into another field.

You could write a VBA script that uses regular expressions, but this can more easily be achieved using a combination of the RIGHT, LEFT, LEN and FIND methods. Continue reading