Opened 14 years ago
Last modified 3 years ago
#12 assigned defect
FOR /r using wildcards can fail or require user intervention
Reported by: | abwillis | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | Version-3.10 |
Component: | Base | Version: | |
Keywords: | Cc: |
Description
I have found that if Extended CD is not turned on then the /r will fail when used with a wildcard.
J:\INVENTORY\BINV.CMD [4] Usage : FOR A[:-rhsda /DFHLR] %var IN (set) DO ... [args]
If it is set then one of two scenario's will occur.
Scenario 1:
If the directory is not in the database, such as on a network drive, then it will proceed to finish fine... though it will give a message that looks like it is failing:
J:\INVENTORY\BINV.CMD [4] SYS0003: The system cannot find the path specified. "\Inventory\L3*"
Scenario 2:
If the directory is in the database then the extended search option is popped up and awaits user intervention. If the user selects a directory then only that one directory is processed. If Esc is pressed then it will proceed to process all matching directories.
Scenario 2 is really undesired when run as a batch process. I have been able to mimic Scenario 1 in this instance by adding junk to the directory match.
Unmodified example that will exhibit scenario 2:
FOR /r L3* %%1 IN (*L3*.txt) DO TYPE "%%1" >>..\inv.csv
Modified to mimic Scenario 1:
FOR /r "L3* /N" %%1 IN (*L3*.txt) DO TYPE "%%1" >>..\inv.csv
I have also replaced the \N with a /N and a d.
I have several hundred directories that begin with L3 such as: L3N5155 with text files that have names such as:
"first second-L3N5155.txt" with the space in the name.
I also have a second set that are in the form of R8A1234 so have a corresponding For statement with R8 replacing L3. I can do what I want with:
FOR /R %serial IN (*L3*.txt;*R8*.txt) DO TYPE "%serial" >>..\inv.csv
but I could potentially run into a situation where both combinations exist in the name such as L3R8255 which would cause duplicates. For this reason I have been using the other approach but as it was running on a network drive I had not realized the Scenario 2 possibility.
I recently setup an OS/2 system with Samba for those file to dump to it and was trying to run the command directly from it when I ran into the problem about the usage. I matched the options to the one it was working and determined it was the Extended CD options that made the difference. It was after turning that on that the FOR worked but when run on the same system it then popped up the extended CD.
I started with 3.04H on the new system and updated to 3.05A to see if that was the issue initially and both exhibit the same behavior.
Change History (2)
comment:1 by , 3 years ago
Owner: | removed |
---|---|
Status: | new → assigned |
comment:2 by , 3 years ago
Milestone: | → Version-3.10 |
---|