Creating a copy of a directory structure

Armed with the knowledge you gained in the previous sections, we will now develop a Go program that creates a copy of a directory structure in another directory: this means that any files in the input directory will not be copied to the destination directory, only the directories will be copied. This can be handy when you want to save useful files from a directory structure somewhere else while keeping the same directory structure or when you want to take a backup of a filesystem manually.

As you are only interested in directories, the code of cpStructure.go is based on the code of traverseDir.go you saw earlier in this chapter: once again, a small program that was developed for learning purposes helps ...

Get Go Systems Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.