Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Use of FileName in script

Hi all,

I have a loop in a dir with FoundFile param which get's a full path with file name into it.

I try to get only the file name, but when I use:

let vTemp3 = filename('$(FoundFile)');

I get NULL in vTemp3.

but in this : let vTemp=  '$(FoundFile)';

I get the correct path.

I tried to remove the single quotes, didn't help.

regards,

Boris

2 Replies
Anonymous
Not applicable
Author

Hi,

You might try something like below.

LET vTemp3 = SubField('$(FoundFile)', '\', -1);

Regards,

Aadil

Siva_Sankar
Master II
Master II

Hi,

Try this,

Sub DoDir (Root)

     For Each Ext In 'qvd' // filetype to search for in current directory

          For Each File In FileList (Root & '\*.' & Ext)

                    Files:

                    Load '$(File)' as WayToFile,

                     FileTime('$(File)') as FileTime,

                     Replace(Mid('$(File)',Index('$(File)','\', SubStringCount('$(File)','\'))+1),'.$(Ext)','') AS FileName,

                    Autogenerate 1;

          Next File

     Next Ext

     For Each Dir In DirList (Root & '\*') // searching in subdirs

          Call DoDir (Dir)

     Next Dir

End Sub

Regards.

Siva