Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to login and download file using perforce command line

I have to download a file daily from perforce depot.

Presently I do it manually by selecting that file and using "Get latest version" option.

I want to write a script which I will schedule in my windows task schedular to get the file daily.

Please help me/guide me how to do this task automatically.

I am using p4v client software in windows XP operating system.

like image 822
anirudh Avatar asked Feb 16 '10 03:02

anirudh


People also ask

What does p4 flush do?

The p4 flush command performs half the work of a p4 sync .


2 Answers

Using P4V will make it hard to automate. I suggest you use the command-line client, p4.exe, instead. If there's only one file that you need the contents of you could simply use "p4 print" and avoid the need for creating a workspace (client) spec, e.g:

p4 print -o <local filename> //depot/path/to/file

Note that the above command requires you to be already logged on to the Perforce server. There's at least two ways around this:

1) Specify the username and password on the command-line (not really recommended for security reasons):

p4 -u myuser -P mypasswd print -o <local filename> //depot/path/to/file

2) Use a dedicated background user for the task, with an unlimited login expiration time (see p4 group and the Timeout field):

p4 -u backgrounduser print -o <local filename> //depot/path/to/file

A licensed "background user" designated for only performing automated tasks can be obtained at no further cost from Perforce Software. Try contacting Perforce support and ask them about this.

like image 135
rjnilsson Avatar answered Oct 05 '22 12:10

rjnilsson


In a bat you can use the p4.exe commandline tool that comes with p4v and issue the sync command:

p4 sync myFileThatINeedToGetDaily.txt
like image 31
akf Avatar answered Oct 05 '22 13:10

akf