If you have used perforce, you’d have definitely come across a situation where you wanted to sync files belonging to two different labels, but as soon as you sync the second label, the files from the first label get deleted. P4 help suggests the following ways to achieve this:

p4 sync @label1,label2

or something like

`p4 sync @label1,@label2``

But I’ve found that depending on the perforce version you are using, the above commands might not work. So, here is a tip that will always work for you irrespective of which version you are using:

p4 files @label | cut --delimiter=" " -f1 | p4 -x - sync -n

It is as simple as that. Let me know what are your perforce tips..