Recursive add all files in a directory with Perforce

Written by Patrick on January 15, 2008 – 11:14 pm -

It is very common to want to add a directory of files to your source control system. With Perforce the command line client doesn’t support this natively. I would think that a command like this would work: “p4 add …”. But unfortunately Perforce displays this non-useful message when you try that:

Can’t add filenames with wildcards [@#%*] in them.
Use -f option to force add.

Instead you have to use a one line shell command to do this. On Windows try this:

“dir /b /s /a-d | p4 -x - add”

For non-Windows platforms you’ll have to do a similar command. Just change the ‘dir’ part to whatever you use to display files in your OS.


Tags: ,
Posted in Random Software Tips |

Leave a Comment