Search code examples
perforcep4api.net

Perforce P4Api.net add file get this Can't add filenames with wildcards [@#%*] in them


string f = "C:\[email protected]"
cmd = new P4Command(p4, "add", true, "-c", changelist.Id.ToString(), f);

When my file name contains "@" this character , it log error exception :

add file get this Can't add filenames with wildcards [@#%*] in them

How do I fix that , I using p4api.net.


Solution

  • From the command line you can pass the -f flag to force files with wildcards to be added:

    C:\Perforce\test\chars>p4 add -n foo@bar
    The file named 'foo@bar' contains wildcards [@#%*].
    Can't add filenames with wildcards [@#%*] in them.
    Use -f option to force add.
    
    C:\Perforce\test\chars>p4 add -n -f foo@bar
    //stream/main/chars/foo%40bar#1 - opened for add
    

    It looks like P4Command lets you just pass a server command (and its arguments) to the constructor, so you should be able to do:

    new P4Command(p4, "add", true, "-c", changelist.Id.ToString(), "-f", f);