Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7958903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:29:28+00:00 2026-06-04T04:29:28+00:00

I have a web app which I’m compiling using steal, and then I just

  • 0

I have a web app which I’m compiling using steal, and then I just want to copy the files from it needed for production use, but I need to preserve the directory structure. So for example, the directory looks like this after running steal’s build (which compiles js/css into the production.js/css files):

\WebApp\index.html
\WebApp\app\img\a.png 
\WebApp\app\img\b.png
\WebApp\app\js\foo.js
\WebApp\app\js\bar.js
\WebApp\app\css\base.css
\WebApp\app\css\app.css
\WebApp\app\css\widget1.css
\WebApp\app\production.js
\WebApp\app\production.css
\WebApp\steal\steal.js
\WebApp\steal\README.md
\WebApp\steal\build\build.js

Out of this, I want to copy only a few specific files to the same dir structure:

\artifacts\staging\www\index.html
\artifacts\staging\www\app\img\a.png 
\artifacts\staging\www\app\img\b.png
\artifacts\staging\www\app\production.js
\artifacts\staging\www\app\production.css
\artifacts\staging\www\steal\steal.js

Ideally I’d have something like this:

<PropertyGroup>
  <WorkingDir>WebApp\</WorkingDir> 
  <OutputDir>artifacts\staging\www\</OutputDir>
</PropertyGroup>

...

<ItemGroup>
  <CopyFiles Remove="@(CopyFiles)" /> <!-- clean existing items -->
  <CopyFiles Condition="'$(Configuration)'=='Debug'"
        Include="$(WorkingDir)\**\*.*" 
        Exclude="$(WorkingDir)\**\.svn\**" />
  <CopyFiles Condition="'$(Configuration)'=='Release'"
        Include="$(WorkingDir)\index.html;$(WorkingDir)\app\img\**\*.*;$(WorkingDir)\app\production.*;$(WorkingDir)\steal\steal.js;" 
        Exclude="$(WorkingDir)\**\.svn\**" />
</ItemGroup>

<Copy SourceFiles="@(CopyFiles)" 
    DestinationFolder="@(CopyFiles->'$(OutputDir)\%(RecursiveDir)%(Filename)%(Extension)')" />

The problem of course the directory structure isn’t preserved, and I actually just get all of the files into the $(OutputDir) with no sub-directories. %(RecursiveDir) is the expansion of ** but since I’ve explicitly specified most paths, it doesn’t actually take effect.


Now I know I can brute force this with a bunch of copy tasks and itemgroups, but that introduces its own problems, aside from being ugly. For one, it’s error-prone, since if someone wants to add an item they have to be sure to use a unique itemgroup name (this build script is big and does many other tasks), and ensure several lines are all in sync.

There must be a better way than this?

<ItemGroup>
  <IndexFiles Include="$(WorkingDir)\index.html" />
  <ImgFiles Include="$(WorkingDir)\app\img\**\*.*" />
  <AppFiles Include="$(WorkingDir)\app\production.*" />
  ...
</ItemGroup>

<Copy SourceFiles="@(IndexFiles)" 
    DestinationFolder="@(IndexFiles->'$(OutputDir)\%(RecursiveDir)%(Filename)%(Extension)')" />
<Copy SourceFiles="@(ImgFiles)" 
    DestinationFolder="@(ImgFiles->'$(OutputDir)\app\img\%(RecursiveDir)%(Filename)%(Extension)')" />
<Copy SourceFiles="@(AppFiles)" 
    DestinationFolder="@(AppFiles->'$(OutputDir)\app\%(RecursiveDir)%(Filename)%(Extension)')" />
....
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T04:29:29+00:00Added an answer on June 4, 2026 at 4:29 am

    I had the same problem, and after some struggling I managed to do it. The key is to specify folders you want to include, after “**”.

    <ItemGroup>
        <CopyFiles Include="$(WorkingDir)\index.html" />
        <CopyFiles Include="$(WorkingDir)\**\app\img\**\*.*" />
        <CopyFiles Include="$(WorkingDir)\**\app\production.*" />
        ...
    </ItemGroup>
    

    As a result, the output directory will contain the app folder with all subdirectories of “img”, and all files named “production”.

    As a note- the part with “RecursiveDir” remains unchanged.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web app which orders stuff using a timestamp, which is just
I have an MVC3 web app to which I want to start using whole
I have a Flash web app which displays user submitted PNG files. Files are
Have an ASP.net web app which works fine for a few days, but then
I have an ASP.NET(2.0 using C#) web app, in which I have a gridview.
We have a web app which can upload files to S3. For this to
I have a web app(jsp/servlets) which allows users to download audio files and play
I'm using VS2010,C# to develop an automation site (ASP.NET web app) which may have
I have a web app which plots points with SVG, I want to add
I have a business web app which is served using SSL only. One of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.