question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CopyFiles doesn't respect source directory structure

See original GitHub issue

What 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:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
thomaslevesquecommented, Jul 18, 2016

Actually… maybe not. I use globbing to specify which files to copy, and CopyDirectory just copies all files.

1reaction
RyannosaurusRexcommented, Jul 18, 2016

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found