Reputation: 66
I am able to copy a file from remote Perforce server to my local machine using this command
p4 print -o <output_filename> <remote_filename>
However, I have two issues here. First, I have to manually specify my output filename. Second, I cannot print out all files and sub-directories within a directory.
What I want to do is coping a specific directory recursively from Perforce server to my local machine directory without creating a workspace on my local machine.
Upvotes: 1
Views: 1563
Reputation: 71424
Easy answer: Discard the requirement to not create a workspace on your local machine, and create a workspace on your local machine. It is way easier and faster to create a workspace, sync -p
, and delete the workspace than it is to re-implement p4 sync
.
p4 --field "View=//depot/path/... //TEMPCLIENT/..." --field "Root=C:\output_path" client -o TEMPCLIENT | p4 client -i
p4 -c TEMPCLIENT sync -p
p4 client -d TEMPCLIENT
Hard answer: Implement your own view mapping logic. Use p4 files //depot/path/...
to get the list of files, then use a regex to map each depot file into a local file, then run a p4 print
command for each pair. It'd look something like:
p4 -F %depotFile% files //depot/path/... | (some gnarly piece of awk/sed/perl that takes "depotFile" as input and produces "print -o localFile depotFile" as output) | p4 -x - run
Upvotes: 2