[<<]Message[>>]    [<<]Author[>>]        Subject            Thread    

Number : 71 Date : 2001-05-17 Author : Kan Yabumoto Subject : XXCOPY /NP switch Size(KB) : 2
Joseph Maddison said he was using a DIR command to locate the files which contains a tilde (the letter "~"). Alas, practically any file with an LFN has that character!!! The trouble using the standard tools such as DIR, COPY, or XCOPY (and most other file management tools for that matter) is that filename match uses not only the primary filename (LFN) but also the alias name (SFN). This behavior makes it impossible to locate a file with "~" in the LFN but not in the SFN. There are other cases where this loose name matching scheme becomes troublesome. For example, try locating files whose main part (before the .extension) ends with the letter "1" (e.g., My_long_name_1.txt). For example, when you have files My_Long_File.Txt (MYLONG~1.TXT) My_long_name_1.txt (MYLONG~2.TXT) TECHSP~1.TXT (TECHSP~1.TXT) And you run the following commands DIR *1* DIR *~* You will find all of the three files will be listed in both cases. You will encounter similar behaviors with COPY and XCOPY. (Due to the deliberate compatibility concern, XXCOPY also does it the same way). This is where XXCOPY's /NP (Precise name-match) feature comes handy. Joseph's headache of locating the "whacked" filenames can be handled by one command. XXCOPY \*~?* /S /NP /LSL This pattern (~ followed by ?) eliminates a case where the filename ends by a ~ because the last asterisk(*) could match "nothing" (?* requires at least one character). The /NP switch throws away the loose matches (commonly done by the standard file tools) for the following files My_Long_File.Txt (MYLONG~1.TXT) My_long_name_1.txt (MYLONG~2.TXT) These files do not contain the ~ character except in the SFN alias. Therefore, the XXCOPY command will match only the TECHSP~1.TXT file whose primary (LFN in this case) filename contains the pattern that was specified. We would love to make /NP as the XXCOPY default behavior but that would generate too many unnecessary tech support calls from surprised users. So, the /NP behavior is not automatic. But, it is nice to remember that XXCOPY can make a precise name matching (Don't bother to remember the mnemonic but look it up when you need it). Kan Yabumoto ========================================================================
This message if part of XXCOPY's message Archive. The archive contains all the messages posted at Yahoo!Groups: XXCOPY.