Is there a way in "Copy Files Tasks" in TFS to Copy the files and also it's Folders and subfolders with it's files - azure-devops

For this example below, I want to use the "Copy Files Tasks" to copy the "Project1" and it's subfolder namely "bin", "ConfigFiles", etc. that contains it's files. But can also copy the folder in "Project1" as a directory and it's files within, to the Target Destination. I don't want to use the "Windows Machine File Copy" tasks...
Thank you in advance.

As Daniel Mann mentioned, you can find the glob patterns in the task link here.
In addition, since you'd like to copy the "Project1" as well, you need to remove it in Source Folder but specify in content.
Sample as below:
I checked the result:

Related

Move files into a folder in GitHub (At their website)

I would like to move files and (if possible) folders into another folder, at a Git repository (trough the GitHub website - so not using the terminal).
Is this possible? if so, how?
A solution is described in the GitHub docs here.
You browse to the file you want to move, click on Edit this file and change the path to your desired path.
You might have to experiment around but the following might be helpful:
This will show you how to move/rename files. You can change the folder path: https://github.blog/2013-03-15-moving-and-renaming-files-on-github/
This here will show you how to create a folder: https://github.community/t/add-a-folder/2304
Renaming a folder will be difficult. How many files are in this folder? You essentially move a file. It's a bloody pain.
I'll adjust this with additional tips.

VSTS Minimatch pattern to exclude .git folder

I'm using VSTS and the build task FTP Upload. When the files and folders are uploaded to my FTP server the .git folder is always copied to the server too.
I tried to exclude the .git folder with file pattern like following:
**
!(**/.git/**)
I don't know why it does not work but is there any way to tell the task with minimatch pattern to exclude folder explicitly?
The minimatch pattern for the file patterns option in FTP Upload task only can exclude the folders. Such as if you use the !**\.git\** as File patterns, it will only remove the .git folder and the subfolders in it, but the files in these folder still upload to FTP server.
If you don’t want the .git folder (including the files in it) to be uploaded to FTP, you can add a Copy Files task before FTP Upload task. Detail settings as below:
Copy Files task
Source Folder: $(Build.SourcesDirectory)
Contents:
**
!**\.git\**
Target Folder: $(Build.ArtifactStagingDirectory)\upload
FTP Upload task
You just need to change below settings,
Source folder: $(Build.ArtifactStagingDirectory)\upload
File patterns: **
Now exclude the files in .git folder, all the files and folders are upload to FTP server.

VSTS Release - Copy Files from subfolder

I have a "Release" that I intend to use to publish to a remote share.
I have created a Copy Files task which works. However my build artifacts are all below two subfolders [UI] Build/drop. I want to copy the contents of the drop folder rather than the entire thing. Unfortunately I only seem to be able to copy the entire thing!
Task (copies all files and folders):
Source Folder: $(System.DefaultWorkingDirectory)/
Contents: **
Target Folder: \\myshare\test
So I tried to only copy the contents (with support from this article) of UIBuild/drop but nothing gets copied in any of these cases:
Changing Source Folder to $(System.DefaultWorkingDirectory)/[UI] Build/Drop.
Keeping Source Folder as it was but changing Contents to [UI] Build/drop/**
Keeping Source Folder as it was but changing Contents to **/[UI] Build/drop/**
Keeping Source Folder as it was but changing Contents to **/drop/**
What am I doing wrong?
After some digging I realised its because there was a square bracket in my artifact. Once I changed my artifact to not use the square bracket everything started working.
Im not sure if its related but this post on minimatch within gulp helped give me the nod

Excluding files/folders from VSTS publish

We are using the new VSO/VSTS style build within TFS on premise, 2015 Update 1 as of yesterday.
During the publish build artifacts stage we want to copy all the files/folders from a root bar 2 sub folders.
ie:
$\somefilestopublish1\...
$\somefilestopublish2\...
$\somefilestoexclude1\...
$\somefilestoexclude2\...
Currently I have **\* as the contents argument which obviously will publish everything. I have tried appending ;-:<exclude_pattern> as suggested by a Google search but that just stopped all output and resulted in an empty folder.
Is there a way to use the minimatch expression to exclude folders or will I need to swap to explicitly selecting the folders to publish instead.
Minimatch use "!" to exclude the given pattern. You could specify it with following format:
!(somefilestoexclude1|somefilestoexclude2)
Following is the example:
With !(bin|obj), "bin" folder and "obj" folder under "WindowsFormsApplication1" folder are not copied to artifact.
!/$tf/** works for me. I've opted to shorten that to !/$*/**
http://www.globtester.com/ helped. The $ symbol doesn't have to be escaped despite conflicting guidance on msdn: https://msdn.microsoft.com/en-us/library/bb383819.aspx.
Suppose you want to collect all the *.nupkg files in your solution (for instance the ones you create during build) and copy them to another folder, but you want to exclude the ones you get through the package restore, you need to specify the following:
**\*.nupkg
!packages\**
It's important to specify them in this order. Placing the exclusion on the packages folder on top, will result in the Copy task copying all the *.nupkg files.
This worked for me for folder try this !**\Uploads***
For file **!(Web.config)
Above example is for excluding a folder and file available in same folder path.
On TFS 2017 Update 1 if you are using the Copy Files task and you want to copy all files from the $(Build.SourcesDirectory) but exclude the $tf folder what I found to work was the following.
In the Contents text box enter the following two lines.
**\*
!$tf\**
This post on social.msdn.microsoft.com is what helped me figure this out.

Install4j "Copy files and directories" installer action does not copy the file directory path

I do a backup of the files that need to be replaced as part of the installation. For this I use the above action. However, it just copies the files in the child directory to the destination directory but not the directory hierarchy of the source to the destination directory. Example: I have a some files in this directory structure \dir1\dir2\dir3\files. It copies only the files under dir3 but not the \dir1\dir2\dir3. I need to preserve the directory structure in the backup. Can anyone help with this please?
I am using Windows 7 Enterprise.
Thanks very much.
You have to select the root directory in the action, i.e. the one containing "dir1". Then, it will copy the whole directory tree to the destination.
If you want to copy only parts of the directory tree, use the "Directory filter" and "File filter" properties.