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
No announcement yet.
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.
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
44 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
56 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
35 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|
||
|
Started by cmoran13, 04-16-2026, 01:02 PM
|
0 responses
95 views
0 likes
|
Last Post
by cmoran13
04-16-2026, 01:02 PM
|
||
|
Started by PaulMohn, 04-10-2026, 11:11 AM
|
0 responses
57 views
0 likes
|
Last Post
by PaulMohn
04-10-2026, 11:11 AM
|

Comment