Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

FileName() function syntax....?

In short, I'm trying to build a table that will give me the names of all the QVDs and QVWs in our main production folder and their last update time (QvdCreateTime()). I'd like to be able to loop through all the filenames in the folder, but have a ways to go for that. Any suggestions or examples?

Right now, I'm trying to use the FileName() function to to capture the file name of a certain path with all the following examples;

LET DataPath = 'C:\Documents'; // Works correctly

LET vPath_File = '$(DataPath)\Abc.QVD'; // Works correctly

LET vTimeStamp = QvdCreateTime('$(vPath_File)'); // Works correctly

LET vFile_Name1 = FileName('$(vPath_File)'); // DOES NOT WORK

LET vFile_Name2 = FileName(["C:\Documents\Abc.QVD"]); // DOES NOT WORK

LET vFile_Name3 = FileName(['C:\Documents\Abc.QVD']); // DOES NOT WORK

LET vFile_Name4 = FileName('C:\Documents\Abc.QVD'); // DOES NOT WORK

Anyone see what I'm missing?

Thanks!

1 Solution

Accepted Solutions
brenner_martina
Partner - Specialist II
Partner - Specialist II

Hi Rob,

do you know DoDir?

View solution in original post

4 Replies
brenner_martina
Partner - Specialist II
Partner - Specialist II

Hi Rob,

do you know DoDir?

Not applicable
Author

I don't think FileName() takes any parameters and it should be used within a Load.

Load *, FileName() As FileName
FROM C:\Documents\Abc.QVD;


Then you could probably:

Peek('FileName', 0, TableName)


You may be able to create a batch file to write out a list of all files in a directory and then read that in. Then loop through each record in the list file.

Not applicable
Author

Thanks everyone! I think this is what I'm looking for...

Not applicable
Author

Hi Martina,

   Could youe please explain, why there was n? ?

  DoDir(root,n)

Thanks and Regards

Satti