Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
But do you know which files have a specific separator? Can you identify them by the filename?
S.
See if this helps
> loop through to load all files from a folder and its subfolders?
I used that post as a guide but I have specific folder name that I need to search by.
set Concatenate=;
// subroutine
sub ScanFolder(Root)
for each Ext in 'File1a.txt' // use this to identify file names to load but I can't use the wildcard to pull all File1*
for each FoundFile in filelist(Root & '\*' & Ext)
FileList:
$(Concatenate)
load *
from [$(FoundFile)](txt, utf8, no labels, delimiter is '\t', msq, no eof); // my load has different parameters depending on the file name.
set Concatenate = concatenate;
next FoundFile
next Ext
for each SubDirectory in dirlist(Root&'\*')
call ScanFolder(SubDirectory)
next SubDirectory
end Sub
Call ScanFolder('C:\');
But do you know which file has a specific separator? For example: *1*.txt has comma, *2* has slash, etc...?
You could try make several loop, one for type of separator
set Concatenate=;
// subroutine
sub ScanFolder(Root)
for each Ext in 'File1a.txt' // use this to identify file names to load but I can't use the wildcard to pull all File1*
for each FoundFile in filelist(Root & '\*' & Ext)
FileList:
$(Concatenate)
load *
from [$(FoundFile)](txt, utf8, no labels, delimiter is '\t', msq, no eof); // my load has different parameters depending on the file name.
set Concatenate = concatenate;
next FoundFile
next Ext
for each SubDirectory in dirlist(Root&'\*')
call ScanFolder(SubDirectory)
next SubDirectory
end Sub
sub ScanFolder_2(Root)
for each Ext in 'File1a.txt' // use this to identify file names to load but I can't use the wildcard to pull all File1*
for each FoundFile in filelist(Root & '\*' & Ext)
FileList:
$(Concatenate)
load *
from [$(FoundFile)](txt, utf8, no labels, delimiter is ',', msq, no eof); // my load has different parameters depending on the file name.
set Concatenate = concatenate;
next FoundFile
next Ext
for each SubDirectory in dirlist(Root&'\*')
call ScanFolder(SubDirectory)
next SubDirectory
end Sub
Call ScanFolder('C:\');
Call ScanFolder_2('C:\');
etc...
S.
Yes.
I'm trying this but only one Loop is working.
But do you know which files have a specific separator? Can you identify them by the filename?
S.
yes. I have all specific separator.