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 CarlTrading, 03-31-2026, 09:41 PM
|
1 response
81 views
1 like
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
41 views
0 likes
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
64 views
2 likes
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
66 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
54 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment