From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get ftp files

Solved!
Go to solution

Hello,

I'm trying to get files from ftp. But I've some problems, all I test doesn't run...

 

I need to read periodically (each 30 seconds) a folder on ftp server (ftp://192.168.2.100/TRACA) to see if it is avoid or not, and what are he files names (I dont' know them per advance). If I find files, I have to move each file from ftp to local folder (C:\temp).

 

I hope there are some ftp functions to do it easily with LabVIEW, but I don't find them, or I use a bad syntax.

I work with LabVIEW 2018 SP1 on a Windows 10 Computer.

Thank you per advance for you help!

 

Francis

Francis M
0 Kudos
Message 1 of 10
(3,239 Views)

Hello Cisco,

a good starting point is always the Example Finder. You can find it in the Help menu. There you can just open the 'search'- tab and type ftp. Try the shipped example.

Greets, Dave
Message 2 of 10
(3,180 Views)

Hello Dave,

 

Thank you, but I've checked examples without finding solution… I can' use the function "get file" (wich open the connexion, transfers file and closes connexion) because I need to discover files names; And it doesn't run… 😞

When it will ok, I think be able to copy files, but 've still Nothing find to delete files on ftp after copy...

 

test ftp.png

Francis M
0 Kudos
Message 3 of 10
(3,165 Views)
Solution
Accepted by Cisco

Did you try the passive mode? I'm sitting behind a Firewall and this forces me to use the passive mode. The List Files- VI has an "Active"- Input too, it should be false then.

Greets, Dave
Message 4 of 10
(3,155 Views)

Thank you, it's much better like this! I can read the files list and do the copy.

 

test ftp2.png

 

My last problem is how to delete files on ftp after copy...

 

Greets,

Francis M
0 Kudos
Message 5 of 10
(3,147 Views)

I've finally find the delete function, in one of the 3 lvlib of "C:\Program Files (x86)\National Instruments\LabVIEW 218\vi.lib\FTP" (ftp 1.lvlib).

It's perfectly run, thank you Dave for your help! I post the code if it can help someone...

 

test ftp3.png

Francis M
0 Kudos
Message 6 of 10
(3,146 Views)

Dear Francis M,

 

You saved my life! Thank you so much for sharing a working code!!!

 

Wish you all the best!

 

Wendy

Message 7 of 10
(1,377 Views)

With pleasure! 🙂

Francis M
0 Kudos
Message 8 of 10
(1,355 Views)

Dear Francis,

I have another question now...I'm good to get file from Remote with ASCII format, but got trouble with Binary, I simply turned binary to True on your code, and I then waited for a long time and I got nothing in my targeted folder. The reason I want to use binary is I found the size of files get from remote is different. the one I got, the size is bigger than the original one. My guess is it's included some returns...

 

Have you try to get a file or put a file with binary format? NI example doesn't work for me. The remote I have is not allowed mget/mput commands. 

 

Best regards,

Wendy

0 Kudos
Message 9 of 10
(1,326 Views)

Hello Wendy,

 

Sorry I haven't never tested this funtionnality, and I'm absolutely not a ftp specialist... What I've made has covered my requierements, then I've stopped the experimentation. In my case, the csv files I transfer do not seem to be modified.

Be carreful: in the help documentation, it's explain that "binary" specifies the transfer mode and not le files format mode.

 

"binary specifies whether to transfer data in binary or ASCII mode. The default is FALSE, in which the VI transfers data in ASCII mode."

 

Regards,

 

Francis

Francis M
0 Kudos
Message 10 of 10
(1,317 Views)