Recursive Add All Files In a Directory With Perforce

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.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published.