The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Importing data from subfolders

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
andy.zld Posted - 01/29/2019 : 11:01:40 AM
I want to write a script, which imports data files form subfolders. Data files form each subfolders are placed in separate worksheet, renaming worksheet with folder name. How with OriginScript get list of subfolders in specified folder?
1   L A T E S T    R E P L I E S    (Newest First)
yuki_wu Posted - 01/30/2019 : 04:04:35 AM
Hi,
You could try to use findfiles X-Function:
https://www.originlab.com/doc/X-Function/ref/findFiles

I wrote a simple example:


strPath$ = System.path.program$ + "Samples"; 
findfiles path:=strPath$ ext:="txt" recursive:=1 fname:=results$;
int nn = results.GetNumTokens(CRLF);
int nFlag = strPath.GetNumTokens("\");
for(int ii = 1; ii <= nn; ii++)
{
	strFile$ = results.GetToken(ii,CRLF)$; //Get Import File
	strFile.GetToken(nFlag+1, "\")$=; //Get the name of subfolder under the strpath$
}


Hope it helps.

Regards,
Yuki

OriginLab

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000