Ant: Create directory containing file if it doesn't already exist?
Posted
by
Benny
on Stack Overflow
See other posts from Stack Overflow
or by Benny
Published on 2010-01-08T22:08:14Z
Indexed on
2012/11/29
5:05 UTC
Read the original article
Hit count: 213
ant
Basically, I get a path like "C:\test\subfolder1\subfolder2\subfolder3\myfile.txt", but it's possible that subfolders 1-3 don't exist already, which means I'd get an exception if I try to write to the file.
Is there a way to create the directory structure the target file is in, either by using some task that creates the structure when it outputs to the file and then deleting the file, or by parsing the directory part of the path and using the mkdir task first?
Any help is appreciated.
Thanks, B.J.
© Stack Overflow or respective owner