Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
i have field like below
c:/rootfolder/file1.txt
c:/rootfolder/file2.txt
how can i trim the path and only get file1.txt file2.txt
Hello, use the subfield function. subfield('c:/rootfolder/file2.txt','/',-1) . BTW you might want to check your example.. it has forward slashes when they're supposed to be '\'...
hope this helps
=subfield('c:/rootfolder/file1.txt', '/', 3)
or filename, from online help
Returns a string containing the name of the table file currently being read, without path but including the extension.
Example:
Load *, filename( ) as X from
C:\UserFiles\abc.txt
Will return 'abc.txt' in field X in each record read.
Hello, use the subfield function. subfield('c:/rootfolder/file2.txt','/',-1) . BTW you might want to check your example.. it has forward slashes when they're supposed to be '\'...
hope this helps
how can i direct output of this code into qvd file.
set vRoot = 'C:\vbscript';
FOR Each Ext in 'qvd'
FOR Each File in filelist ('$(vRoot)'&'\*.'&Ext)
Load subfield('$(File)','\',3) as Name, FileSize( '$(File)' ) as
Size, FileTime( '$(File)' ) as FileTime
autogenerate 1;
next File
next Ext
this will work
=subfield('c:/rootfolder/file1.txt', '/', 3)
Give your table a name then use the STORE statement: e.g.
set vRoot = 'C:\vbscript';
FOR Each Ext in 'qvd'
FOR Each File in filelist ('$(vRoot)'&'\*.'&Ext)
TableList:
Load
subfield('$(File)','\',-1) as Name, //
FileSize( '$(File)' ) as Size,
FileTime( '$(File)' ) as FileTime
autogenerate 1;
next File
next Ext
STORE TableList into C:\path\TableList.qvd;
I get syntax error and execution error when i do this:
set vRoot = 'C:\vbscript';
TableList:
FOR Each Ext in 'qvd'
FOR Each File in filelist ('$(vRoot)'&'\*.'&Ext)
TableList:
Load
subfield('$(File)','\',-1) as Name, //
FileSize( '$(File)' ) as Size,
FileTime( '$(File)' ) as FileTime
autogenerate 1;
next File
next Ext
STORE TableList into C:\path\TableList.qvd;
Are you using a valid path?
yes
Delete the 3rd line on the script (where says TableList:). That will fix it. You are specifying the table name right before the LOAD statement