I am trying to read only file names not the full path and I am trying to compare them between them. for example, if there are 3 file in a directory A, B and C. I am trying to read A, B, C as string and if my barperiod is equal to A, then I want to print B, nothing else. I have tried many ways available, but stuck here. Could not find anything related in help guide. Can anyone guide me to the right direction please?
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Reading file names only and compare them
Collapse
X
-
Reading file names only and compare them
Hi,
I am trying to read only file names not the full path and I am trying to compare them between them. for example, if there are 3 file in a directory A, B and C. I am trying to read A, B, C as string and if my barperiod is equal to A, then I want to print B, nothing else. I have tried many ways available, but stuck here. Could not find anything related in help guide. Can anyone guide me to the right direction please?Tags: None
-
Hello asmmbillah,
Thank you for the post.
This would not really be a NinjaScript question so you won't find anything on this in the help guide. For this you could search online for "C# get filename from path" to get some suggestions. You essentially just need to take the filename out of the paths you found which there are many ways to do.
Here is one way using Path.GetFileName() https://docs.microsoft.com/en-us/dot...tframework-4.5
You could make another list of just names or do whatever you needed once you strip the path and get just the name. If you need to also strip the extension, you could search for "C# get filename without extension".
I look forward to being of further assistance.
JesseNinjaTrader Customer Service
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Brevo, Today, 01:45 AM
|
0 responses
6 views
0 likes
|
Last Post
by Brevo
Today, 01:45 AM
|
||
Started by aussugardefender, Today, 01:07 AM
|
0 responses
3 views
0 likes
|
Last Post Today, 01:07 AM | ||
Started by pvincent, 06-23-2022, 12:53 PM
|
14 responses
242 views
0 likes
|
Last Post
by Nyman
Today, 12:47 AM
|
||
Started by TraderG23, 12-08-2023, 07:56 AM
|
9 responses
384 views
1 like
|
Last Post
by Gavini
Today, 12:29 AM
|
||
Started by oviejo, Today, 12:28 AM
|
0 responses
6 views
0 likes
|
Last Post
by oviejo
Today, 12:28 AM
|
Comment