2 Replies Latest reply: Jan 2, 2014 4:48 AM by sivasankar kanagasabai RSS

    Use of FileName in script

    Boris Kacevich

      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

        • Re: Use of FileName in script
          Aadil M

          Hi,

           

          You might try something like below.

           

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

           

          Regards,

          Aadil

          • Re: Use of FileName in script
            sivasankar kanagasabai

            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