Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hey guys,
i want to read all the .txt file from a folders (sub dir included) and i use the following script
sub DoDir (Root)
for each File in filelist (Root&'\*.' &'TXT')
lista_fisiere:
Load
'$(File)' as path
autogenerate 1;
next File
for each Dir in dirlist (Root&'\*' )
call DoDir (Dir)
next Dir
end sub
DoDir(Path);
The script works fine till encounters one folder or txt files which contains quote character ( ' ) in the name.
Anyone know a workaround?
You could use purgechar function to remove them
purgechar('$File', chr(39))
Regards,
Gordon
I cant use PurgeChar because based on the name of the file i need to load that folder or not.
have a batch file that renames the files prior to reload?
-Alex
not a possible solution because those file are used by other application also
Hi,
Use nested FOR loops . The quote will get escaped == will appear twice in the loaded field. Works in QV9 64 bits, and QV10 32 bits.
for each Dir in dirlist (Root&'\*' )
for each File in filelist (Dir &'\*.' &'TXT')
lista_fisiere:
Load
'$(File)' as path
autogenerate 1;
txt:
LOAD @1 as txt
FROM [$(File)] (txt, codepage is 1252, no labels, delimiter is '\t', msq);
next
next
-Alex