Perforce tip - Find all un-added files

When using Perforce, there’s no easy way to determine which files are new and need to be marked for addition to the repository. In subversion and others, this is a simple matter of running svn status in your checkout directory. Sadly, Perforce lacks this simple feature. The P4Win client includes a ‘Local Files Not In Depot’ view but that involves navigating through and opening every single folder to determine if there’s a new file within. Quite tedious, to say the least.

I’ve found this command, run from your client checkout directory, to be a workable alternative:

 C:\...> dir /s /b /A-D | p4 -x - have > nul

If you have a suitable grep.exe on your path, then you can filter out un-wanted files like this:

 C:\...> dir /s /b /A-D | grep -v class$ | p4 -x - have > nul

On Linux, replace dir with find to get something like:

$ find . -type f | grep -v class$ | p4 -x - have > /dev/null