LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I loop a search algorithm to look for new files in a directory and store the file names in a string?


@SteveChandler wrote:

In that case it is very simple. There is a vi called list folder in the advanced file functions. It returns an array of filenames. Just run that periodically.

 

list folder.png



And I meant this example, but for LV 2009. Thanks!

0 Kudos
Message 11 of 24
(920 Views)

Okay.  It wasn't clear which example you were talking about.  That is correct.  Since it is a 2010 snippet, it won't load in 2009 directly as far as I know.

 

Fortunately, that example is so simple, it would be quicker for you to draw it from scratch than it would be to ask for it.

0 Kudos
Message 12 of 24
(911 Views)

I tried - but I have difficulties finding the "filenames" array. What is the exact function name for it?

0 Kudos
Message 13 of 24
(905 Views)

@Ravens Fan wrote:

Okay.  It wasn't clear which example you were talking about.  That is correct.  Since it is a 2010 snippet, it won't load in 2009 directly as far as I know.

 

Fortunately, that example is so simple, it would be quicker for you to draw it from scratch than it would be to ask for it.



Actually I re-created it in LV2009, however it does not seem to work. I attached it below.

0 Kudos
Message 14 of 24
(897 Views)

It is called List Folder. You can find it under FileIO/Advanced File Fuctions. i am not sure why it is considered an advanced function.

=====================
LabVIEW 2012


0 Kudos
Message 15 of 24
(896 Views)

@wprice wrote:


Actually I re-created it in LV2009, however it does not seem to work. I attached it below.



Your VI works okay for me.

0 Kudos
Message 16 of 24
(892 Views)

Are you having trouble selecting the directory you want to list? Right click on the path control and select browse options and change the selection mode to folders.

=====================
LabVIEW 2012


0 Kudos
Message 17 of 24
(891 Views)

@SteveChandler wrote:

Are you having trouble selecting the directory you want to list? Right click on the path control and select browse options and change the selection mode to folders.



That would be it.  It also explains why it worked for me.  I just typed in c:\ into the path control and it worked.  I didn't browse to anything.

0 Kudos
Message 18 of 24
(888 Views)

@SteveChandler wrote:

Are you having trouble selecting the directory you want to list? Right click on the path control and select browse options and change the selection mode to folders.



Yes - got it now, thanks!

0 Kudos
Message 19 of 24
(869 Views)

That's good if you have your solution, but I wanted to give another method for monitoring file activity.  I used the File/Directory Info function to get the last modified date.  The other two VIs are simple FGVs that read and write the date modified.  It's a simple comparison from there.  The VI will detect if new data has been written to the file.  You can do something similar for the entire folder (awaiting a new file) by using the List Folder function to acquire the files and then monitor for the newest in a similar fashion as the attached.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 20 of 24
(858 Views)