Copy files from one path to another path in TFVC repository using Powershell - azure-powershell

I am trying to copy files from one folder path to another folder path in the TFVC repository using Powershell script in CI as mentioned below.
Get-Item -path $/SCSM/CMC/1.1.0.0/Dev/1.1.1.0/TSC/ServiceRuleScript - Destination $/SCSM/CCB/1.0.0.0/Dev/1.0.1.0/TSC/RulesEngine
When trying the above script getting the below error:
Copy-Item : Cannot find path 'C:\privateagent\_work\66\s\$/SCSM/CMC/1.1.0.0/Dev/1.1.1.0/TSC/ServiceRuleScript
We tried with the copy file task in CI, it is getting executed but we are unable to see the file in the destination folder path
enter image description here
Please help me out with this task.

The problem is that your Source Folder is wrong.
Use this Predefined variables:
$(Build.SourcesDirectory)\{your folder want to be copied}
It works on my side:

We are trying to call file from one path "Masters\DbProject\V1.0.0.1\PowershellScripts
and we are using the copy task to call file in another path "CCM/1.0.0.0/1.1.0.0/Dev/1.1.1.0". Both are different paths. When we are trying to call the file using copy file task getting the below error.
##[error]Unhandled: Not found SourceFolder: C:\privateagent_work\66\s\Masters\DbProject\V1.0.0.1\PowershellScripts
But the file which we are trying to call is in the below path: "C:\privateagent_work\79\s\Masters\DbProject\V1.0.0.1\PowershellScripts
We have mentioned the below path in our copy task
Source folder in copy task - $(Build.SourcesDirectory)\Masters\DbProject\V1.0.0.1\PowershellScripts
The problem here in the copy task is - The copy file task should call file from "C:\privateagent_work\79\s\Masters\DbProject\V1.0.0.1\PowershellScripts" but it is trying to call the file from "C:\privateagent_work\66\s\Masters\DbProject\V1.0.0.1\PowershellScripts
Please share your inputs.

Related

how to copy all files in a folder recursively in cpanel yml

im currently setting up a cpanel.yml file and i need to copy all the file inside one specific folder in my repository to my /public_html.
/bin/cp -R build $DEPLOYPATH
the code above copy the build folder to the /public_html. But i need to copy all the file inside it not the actual build folder.
any suggestion how to do it? any help would be appreciated. thanks

Jenkins Error: fatal error C1083: Cannot open include file: 'xyz.h': No such file or directory

Can any one please tell me how to resolve this kind of error?
This header file placed in different folder and project.sln file present in some other folder. but both folders are present at same master folder like :
Project_Data(main folder)
1. Source_code (project.sln present here)
2. Supported_Files(xyz.h file present here)
and in jenkins i give the svn location of master folder.
Firstly thank you for your response to my question. Now i got the solution of above error.
In this case we can change the location of missing file(i.e which is not found by jenkins while exection) to folder where .sln file placed.We can do this process manually or we can write execution script to automate this process.
Thanks :)

Remove Structure from Copy

I have a Task on my TFS build to Copy files to the staging folder:
Currently, this builds the staging folder with all the subfolder structure, e.g. \MyProject\bin\release\
Is there a way to set this so that it dumps to just \MyProject\, without the bin\release portions?
You can try change the output path :
Configure the build configuration output path, eg set ".\" as
out path (In solution right click the project > properties > Build > Output > Output path).
Specify the output path in MSBuild Arguments such as
/p:OutputPath=$(Build.BinariesDirectory) then copy from $(Build.BinariesDirectory) directly. Reference screenshot below.
Besides, you can also try to copy the contents to stage folder first. then add another Copy Files step to copy the \MyProject\bin\release\** to \MyProject

Using SSIS package to zip all the txt files and move to related folder [duplicate]

I am trying to zip the contents of a Folder in SSIS, there are files and folders in the source folder and I need to zip them all individually. I can get the files to zip fine my problem is the folders.
I have to use 7.zip to create the zipped packages.
Can anyone point me to a good tutorial. I haven't been able to implement any of the samples that I have found.
Thanks
This is how I have configured it.
Its easy to configure but the trick is in constructing the Arguments. Though you see the Arguments as static in the screenshot, its actually coming from a variable and that variable is set in the Arguments expression of Execute Process Task.
I presume you will have this Execute Process task in a For Each File Ennumerator with Traverse SubFolders checked.
Once you have this basic setup in place, all you need to do is work on building the arguments to do the zipping, how you want them. A good place to find all the command line arguments is here.
Finally, the only issue I ran into was not providing a working directory in the command line arguments for 7zip. The package used to run fine on my dev environment but used to fail when running on the server via a SQL job. This was because 7zip didn't have access to the 'Temp' folder on the SQL Server, which it uses by default as the 'working directory'. I got round this problem by specifying the 'working directory as follows at the end of the command line arguments, using the -ws switch:
For e.g:
a -t7z DestinationFile.7z SourceFile -wS:YourTempDirectoryToWhichTheSQLAgentHasRights

Copy file and run command

I'm new to the scripting world and need help. I have been using RoboCopy to copy a file from one server to another.
With RoboCopy, I used /xo to only copy the newer file. Now I need a script to copy a new file from source to destination and then run the command CrcTool.exe against the file just copied.
The problem is that I don't know the file name that was copied so I don't know how to execute the CrcTool.exe