Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Friends. Help me find the right way to get filename.
I'm doing the following:
In Root folder all is OK. But when i'm trying to get filename in SubDirectories all fall.I mean that the following construction
Hi,
Try with the below script
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
Hope it helps
There are another file-functions like filename(), filebasename() and so on - see by file-functions.
- Marcus
HI
Try like this
Hi,
Try with the below script
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
Hope it helps
I want to separate the data load script based on filename
FilesAndFolders:
LOAD
Name,
Path,
IsDirectory,
Size,
SubField(SubField(Name,' ',1),'_',2) as newfile
FROM [lib://sftp_url (allenlund_nprinting)]
LET vNoOfFiles = NoOfRows('FilesAndFolders');
with the above script i get below output
i just want to make separate load script for weekly_3_day_rates and weekly_7_day_rates .as all tables contains same no of rows and coulumns.
thank you 🙂
Hi
Are you want to load only weekly files? If so, try like below
LOAD
Name,
Path,
IsDirectory,
Size,
SubField(SubField(Name,' ',1),'_',2) as newfile
FROM [lib://sftp_url (allenlund_nprinting)]
Where Wildmatch(Name, 'week*')=-1;