Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All
I am currently scanning a directory for certain files. How do i skip the rest of the script if it doesn't find any of the following files? Please see below for script. So if it cannot find anything in the (Lease File List), i want it to ignore the call for Documentlist_leases and skip to //SubFileLIst
// Lease file list
sub DoDir (Root)
for each Ext in 'txt', 'xlsx', 'docx', 'pdf', 'msg'
for each File in filelist (Root&'\*.' &Ext)
DocumentsList_Leases:
LOAD
'$(File)' as LeasefullPath,
SubField('$(File)', '\', 6) as PML_SEQ, //return everything after the 5th '\'
Right( '$(File)', Len( '$(File)') - FindOneOf( '$(File)', '\', 6) ) as LeaseFileName
autogenerate 1;
next File
next Ext
for each Dir in dirlist (Root&'\*' )
call DoDir (Dir)
next Dir
end sub
call DoDir ('\\AKL-SQL01.anz.corp.local\IIS_$(vClient)\F_Pm_Lease\')
Call StoreAndDrop('DocumentsList_Leases');
//Sublease file list
sub DoDir (Root)
for each Ext in 'txt', 'xlsx', 'docx', 'pdf'
for each File in filelist (Root&'\*.' &Ext)
DocumentsList_Subleases:
LOAD
'$(File)' as SubleasefullPath,
SubField('$(File)', '\', 6) as F_Pm_Sublease_SEQ, //return everything after the 5th '\'
Right( '$(File)', Len( '$(File)') - FindOneOf( '$(File)', '\', 6) ) as SubleaseFileName
autogenerate 1;
next File
next Ext
for each Dir in dirlist (Root&'\*' )
call DoDir (Dir)
next Dir
end sub
call DoDir ('\\AKL-SQL01.anz.corp.local\IIS_$(vClient)\F_Pm_Sublease\');
Call StoreAndDrop('DocumentsList_Subleases');
If NoOfRows('DocumentsList_Subleases') > 0 Then
Call StoreAndDrop('DocumentsList_Subleases');
EndIf
-Rob
If NoOfRows('DocumentsList_Subleases') > 0 Then
Call StoreAndDrop('DocumentsList_Subleases');
EndIf
-Rob
Thank you! This works a treat!
Hey
Another question. We've pulled massive files from our network already, and its good to re-run the script every now and then so that it gets the latest files. But is there a way to skip files which we already have pulled into the qvd? LIke a skip for it, and only pull the latest ones?
Just to clarify. You are not actually loading data from those files, you are just building a list of filenames, correct?
-Rob
Yep. Not loading, building a list of filenames.
Basically, filenames will be put into a table, which will create links to said filename. That's all, pulling data from the files themselves
I can't think of ways to "skip" files that would be any faster than what you are doing. Unless your directories are by date and you could skip entire directories.
-Rob
Unfortunately, all our files our files are not by dates but by actual document name.
I'll see if we can do something about the naming, but thanks for the help on the rest 🙂