[p4] UNIX dot files into Perforce

John Hopkins johnh at ca.sophos.com
Wed Aug 22 16:38:05 PDT 2007

> > We are archiving some  2Gb of UNIX directories into a Perforce depot.
> > There are many directory levels there, many symbolic links and many dot
> > files (files whose names begin with a dot), as well as dot directories.
> > The problem is how to p4 add all files including these dot files and
> > directories  to a changelist while using filespec wildcards, short of
> > writing complex UNIX shell scripts that locate them and add them one by
> > one..
> >
> >  "p4 add dir/*/*"  and variations thereof do not pick them up.   I suspect
> > there must be a simple answer to this question, but I just haven't stumbled
> > upon it.
> >   
> Some variation on:
>     DIRS=<your dirs here>
>     for dir in $DIRS do
>         find $dir -type f -print
>     done | p4 -x - add
> should do the trick reasonably efficiently.  Be sure to check the man 
> page for your version of find(1) -- GNU in particular comes garlanded 
> with options.

A slight modification that will also find symlinks:

# find $dir -type f -print -o -type l -print


John Hopkins
Build Engineer, Sophos
Sophos - security and control

More information about the perforce-user mailing list