Copy template folder to current folder with environment variable - environment-variables

I would like to speed up the process of creating folders, I have a template folder with subdirectories that I use often and every time I have to go there in the path where the template folder is and copy it to start a new project.
The thing is, I thought of creating an environment variable that would do this for me, the variable would execute a command like this robocopy "%~d0\model folder\" "%cd%" /e
That is: copy the contents of the model folder path that is on that same drive and paste it in the folder where this command prompt is open.
Obviously this doesn't work, because if the command prompt is already open in a folder it won't be able to access the source path to make the copy...
Any idea how I could make it work?

Related

Is there a definite current directory for commands being run in Pre-Build event of Delphi projects?

I'm running a BAT file from the Pre-Build event of my Delphi projects to update certain files prior to each build. It currently contains hard-coded folder names pointing to the current project's folder. I'd like to try to make this relative to the folder of the current project so I can use the same file for all projects. Is there a way to know for sure what the current directory will be when this file is run? Or is there a symbol in Delphi that represents the folder of the project that I could pass to the BAT file as a parameter?

TFS 2017 build Copy files from

In a build, we have Copy files from the task. The problem we have is the source folder itself is copied to the destination. We'd want the contents of the source folder to be copied to the destination folder, not the folder itself. Is there any way to do that?
I tried a wildcard but that doesn't work. It seems it needs a path itself. An issue of this could be that the source is named 'X' but the destination is named 'Y' (it was setup before this build and IIS is pointing to this folder). Can we have the source folder be renamed in the build maybe?
That would be name_of_sourcefolder\**\* for all files and subfolders of just name_of_sourcefolder\* for all files.
This has to be set in the Contents part of the task.

Repository mapping to fixed path

As part of my build, I want to map a sub folder to a fixed folder on the c:\ drive.
The problem is when I try and map it, I get this :
How can I change the local path on 1 item to not be prefixed with $(build.sourceDirectory)?
A file path input (has ...) defaults to relative paths.(In Mappings, it is Server Path) A relative path is relative to the root of the repo in build and root of artifact downloaded in RM. Build sources directory happens to point to the root of the repo.
So the Local Path is prefixed with $(build.sourceDirectory). It's by designed. You can't change the local path on 1 item to not be prefixed with it.
In your situation, the fixed path clearly should be out of the path on the build agent where your source code files are downloaded. So suggest you to use the copy files Task to achieve what you need. However, you may have to set the fixed path as an UNC shared path.
Update
After go through the extension info, seems the copy task is the only solution for now. And you could add a powershell script, after the first copy , compare the sub folder in TFS server with the fixed path. Then you just need to copy the new add things in the sub folder to the fixed path.

Using the Robot Framework plugin, how to copy files outside the log folder into Jenkins?

I am running Robot Framework tests through Jenkins, and the tests use a custom Python library to take screenshots, save them into a specific folder (that is not the log folder), and embed them into the log. In the Jenkins job, I have a post-build action set to publish the Robot results, and I can get Jenkins to copy image files that are generated within the log folder, but I can't figure out how to copy image files that are generated outside the log folder.
The project's %WORKSPACE% is d:\git\product\registration
The directory of Robot output is \log\patient_search (the log directory is generated inside the registration directory)
The directory where the other images are generated is d:\git\product\registration\verify\images
If I put *.png into the "Other files to copy" box, Jenkins will copy any images within the log\patient_search directory and they embed correctly into the log. What I have in that box now is *.png,%WORKSPACE%\verify\images\**, and I have tried using backslashes instead, using a relative path (..\..\verify\images\**\*.png), and various combinations of asterisks and slashes. Those images always show as broken links in the log.
Are these paths wrong, or can this just not be done for files outside of the log folder?
I believe Robot Framework plugin "Other files to copy" works only inside "Directory of Robot output". A workaround would be to create a build step where you execute a shell and copy files to Robot output directory.

TFS 2010 Team Build - rename a file

As part of my TFS 2010 team build, I'm trying to copy a configuration file from a network location to the output folder where the build goes to.
Using xcopy as an invoke process task, I've successfully gotten it all working EXCEPT that I want to rename the file as part of the copy. The problem is that if you supply a different destination filename, XCOPY asks if the destination is a file or a directory e.g.
XCOPY \\networkshare\configs\live.config \\networkshare\release\server.exe.config /R /Y
results in XCOPY asking me to press F if server.exe.config is a file or D if it's a directory. XCOPY doesn't seem to have any way to suppress this behaviour. I've tried using the basic COPY commmand but Team Build just says that it doesn't recognise the COPY command.
Is there any way to easily rename a file as part of Team Build or use another command line tool to achieve this?
Cheers
Just to confirm - setting the process as CMD.EXE and starting the arguments as "/c copy" does the trick.

Resources