# Generating \include directory

This topic is 5054 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I can't figure this out for the life of me. I have a project with a pretty complex directory structure, say [...]/projectsrc/[...]. I want to generate an include directory ([...]/projectsrc/include) at the beginning of every build on a windows machine. I've spent quite a bit of time trying to figure out how to do it using windows batch files but I can't seem to get it to work. XCOPY keeps telling me about a cyclic copy (can't I just tell it not to recurse once it detects a cycle?) Also is there a way to get XCOPY to copy all the files into /include without generating a directory structure? This is driving me nuts, seems like a very common thing but there is no info on it online. Also while we're at it, can someone suggest a good bash script to do the same thing (doing it on linux is my next project). Thanks.

##### Share on other sites
mkdir (Windows)
mkpath (Unix)

I'm sure I'm missing the actual complexity here.

##### Share on other sites
Thanks Oluseyi. If you could suggest a command that recursively copies all .h files in the project into the newly created include directory, that'd be even better [smile]

##### Share on other sites
There isn't a simple command for that, but you can write a script that walks your directory and copies all files matching the *.h pattern to the target directory. Python has an excellent customizable method, os.walk(...). Its last parameter is a function to be called at each level.

##### Share on other sites
In windows (at least XP...), something like:
> for %f in (*.h) do copy %f [insert_your_new_path_here]%f

Use
> help for

John B

##### Share on other sites
Hmm, may be I should try Python... I've been planning to get into it for quite some time anyway, now I actually have an excuse.

##### Share on other sites
Here's another good reason: it functions as a portable shell scripting language. No more worrying over various platforms' shell languages.

1. 1
Rutin
19
2. 2
3. 3
JoeJ
16
4. 4
5. 5

• 26
• 20
• 13
• 13
• 17
• ### Forum Statistics

• Total Topics
631700
• Total Posts
3001781
×