In Perforce, how do I find the local path for files in a pending changelist?

p4 opened -s -c <changelist#> | awk -F " " '{print $1}' | p4 -x - where | awk -F " " '{print $3}'

You could of course also use

p4 -ztag opened -c changelist

This will report both the depotFile and the clientFile for each opened file. To list only client files:

p4 -ztag opened -c changelist | grep clientFile | awk '{print $3}'

Replacing //client/ with the client's root is left as an exercise for the reader.


To output the local path of all pending adds of a changelist you can use:

p4 opened -c changelist | grep -w add | sed 's/#.*//' \
| p4 -x - where | awk '/^\// {print $3}'

This does the same without grep but is a bit more obscure:

p4 opened -c changelist | sed -n 's/\(.*\)#.*- add .*/\1/p' \
| p4 -x - where | awk '/^\// {print $3}'

Local path for all files in a pending changelist without any external or platform-specific tools:

p4 -F %clientFile% fstat -Ro -F action=add [-e CHANGE] //...

Remove the '-F action=add' if you want to get files opened for all actions.

Tags:

Perforce