I need to copy the folder with multiple files to another folder in build pipeline.
I use
cp -R -v pathToSourceFolder pathToDestFolder
cp -R -v /Users/runner/runners/2.166.4/work/1/s/en.lproj/ /Users/runner/runners/2.166.4/work/1/s/platforms/ios/AppName/Resources
and I am getting error with exit code 126:
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
can anyone help with this as I am new to linux/macOS uses/cmd? Note: pipeline run on macOS.
I need to copy the folder with multiple files to another folder in build pipeline.
1.I assume /Users/runner/runners/2.166.4/work/1/s
is the default working folder of your build. So please avoid hard-coding the path, instead you can use $(System.DefaultWorkingDirectory)
which represents that path. See Azure Devops predefined variables.
2.Since your original purpose is to copy the files in Azure Devops pipeline, you don't need to care too much about the corresponding copy syntax in different OS systems (Linux,MacOS or Windows).
You can do what you want easily using official Copy Files task. This task requires three inputs: Source folder
, Target folder
and Contents
we want to copy, that's it.
Classic UI format:
You can choose the source folder via Browse Source Folder
option. And then use **
as Contents, $(System.DefaultWorkingDirectory)/platforms/ios/Fixi/Resources
as Target folder.
Yaml format:
- task: CopyFiles@2
displayName: 'My Copy Task'
inputs:
SourceFolder: en.lproj
TargetFolder: '$(System.DefaultWorkingDirectory)/platforms/ios/Fixi/Resources'
We've done the logic in the behind for you so that you can use this task in MacOS/Linux/Windows easily. Log of my test: