By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Why doesn't this @Field function work?

The best way to start is probably to show a complete TCC session:
[Z:\Level 1\Level 2\Level 3\Level 4\Level 5\Level 6]fdir
12/24/2012  10:57              0  ABC.SEXT
12/24/2012  10:57              0  DEF.LEXTENSION
12/24/2012  11:00              0  GHI.BEXTEN
[Z:\Level 1\Level 2\Level 3\Level 4\Level 5\Level 6]echo %Sep
[Z:\Level 1\Level 2\Level 3\Level 4\Level 5\Level 6]PDir "::(SEXT|LEXTENSION)" /S
/A-D /(~@Field[%Sep,-2,*]~ @FileName[*])
[Z:\Level 1\Level 2\Level 3\Level 4\Level 5\Level 6]
The first line shows the current directory, the second through fourth lines what's in the current directory. The sixth line shows the contents of a variable named "Sep". The seventh line is a PDir command with an @Field function enclosed in tildes with the field separator being "%Sep" (a backslash, of course), the second field of the full path up (should be "Level 5" me thinks) and the current full file name being indicated by the "*", of course.

As you can see above, what comes out between the tildes is nothing, a null string.

Where am I going wrong in this apparently simple task?

An update:

In experimenting while typing this posting, I changed the @Field function to "@Field[%Sep,-2,%%@Full[*]]", and this worked. The question is, of course, why I need the "@Full" function given that the asterisk is, as I understand it, already the full path to the file (and some simple experiments confirm that). Since at this point I have the problem solved with a mysterious (to me!) workaround, the answer to this question is just for my edification/education.

Similar threads