Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
FrankC
Creator
Creator

File Name and Date

I would like to loop through a folder and get the file name and update date.  I would like to create a dashboard that shows the last time a file (qvd) was updated.

 

Can anyone point me in the right direction?

 

thanks

Labels (2)
1 Solution

Accepted Solutions
dplr-rn
Partner - Master III
Partner - Master III

Use below as a baseline. 

set vRoot = '.';

FOR Each File in filelist ('$(vRoot)'&'\*.qvd')
	CurrentFileList:
	Load 
		'$(File)' as File
		,FileTime(	'$(File)') as LastUpdate	
		autogenerate 1;	 	
next File

 it loops through all qvds in a folder (vroot) and created table with file name-path and last update datetime

View solution in original post

2 Replies
dplr-rn
Partner - Master III
Partner - Master III

Use below as a baseline. 

set vRoot = '.';

FOR Each File in filelist ('$(vRoot)'&'\*.qvd')
	CurrentFileList:
	Load 
		'$(File)' as File
		,FileTime(	'$(File)') as LastUpdate	
		autogenerate 1;	 	
next File

 it loops through all qvds in a folder (vroot) and created table with file name-path and last update datetime

Taoufiq_Zarra

@FrankC  you can customize the below code :

Set $v_File_root = FileTime('C:...'); // your folder path

Set vConcatenate = ;

sub ScanFolder(Root)


                    for each FoundFile in filelist( Root & '\*.*');

                              FileList:

                              $(vConcatenate)

                              LOAD *,
                              FileTime('$(FoundFile)') as XX,
                              FilePath('$(FoundFile)') as YY,
                              '$(Root)' as ZZ

                              FROM [$(FoundFile)] (txt, codepage is 1252, embedded labels, delimiter is '\t', msq);

                              Set vConcatenate = Concatenate;
                             

                    next FoundFile

          

          for each SubDirectory in dirlist( Root & '\*' )

                    call ScanFolder(SubDirectory)

          next SubDirectory

end sub

Call ScanFolder('C:\.....') ;

 

you need FileTime() for the update information ....

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉