CopyFiles doesn't respect source directory structure
See original GitHub issueWhat You Are Seeing?
If I have a directory structure like this:
root
-- subdir1
---- bar.dll
-- subdir2
---- baz.dll
-- foo.exe
When I execute this:
CopyFiles("root/**/*", outputDir);
The files are copied to a flat directory structure, instead of preserving the original structure:
outputDir
-- foo.exe
-- bar.dll
-- baz.dll
What is Expected?
The same structure as in the source folder
outputDir
-- subdir1
---- bar.dll
-- subdir2
---- baz.dll
-- foo.exe
What version of Cake are you using?
0.11
Are you running on a 32 or 64 bit system?
64 bit
What environment are you running on? Windows? Linux? Mac?
Windows 8.1
Are you running on a CI Server? If so, which one?
Not at this point, just testing locally (but eventually it will run on Jenkins)
How Did You Get This To Happen? (Steps to Reproduce)
As described above
Output Log
...
========================================
PublishArtifacts
========================================
Executing task: PublishArtifacts
Copying file foo.exe to D:/path/to/outputDir/foo.exe
Copying file bar.dll to D:/path/to/outputDir/foo.exe
Copying file baz.dll to D:/path/to/outputDir/foo.exe
Finished executing task: PublishArtifacts
...
I realize this may be the intended behavior, but I don’t think it makes much sense… especially since there doesn’t seem to be an easy way to manually list and copy the files.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:12 (9 by maintainers)
Top Results From Across the Web
docker - Dockerfile copy keep subdirectory structure
@Thomasleveil, it seems they want to preserve the directories, but the star makes Docker to copy the internals of the directories instead. – ......
Read more >How to copy file preserving directory path in Linux?
I have Eclipse projects and ".project" file in them, the directory structure looks like ' myProject/.project '. I want to copy these '.project' ......
Read more >cp - Copy specific file type keeping the folder structure
7 Answers 7 ... Even though -execdir is safer than -exec , simply replacing one with the other does not preserve the folder...
Read more >[SOLVED] Copy Files to a Different Location While Keeping ...
Let's say I have this path: /Folder 1/Folder 2/Folder 3/File.txt. Now I want to copy File.txt to Dropbox, for example, but I want...
Read more >Copying files (cp command)
Use the cp command to create a copy of the contents of the file or directory specified by the SourceFile or SourceDirectory parameters...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Actually… maybe not. I use globbing to specify which files to copy, and
CopyDirectory
just copies all files.I could totally be missing something here, but is what you want actually CopyDirectory instead of Copy files? I ran into a similar thing where I tried to use CopyFiles to copy a directory and ended up using CopyDirectory, which worked for me.