LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Backing Up an RT Target via FTP

I'm trying to make an automated script that will backup a directory on my RT target via FTP.  The pertinent line I am using is
 
ftp -s:ftpcomm.txt -user:anonymous -password:guest 192.168.0.2
 
where ftpcomm.txt is a plaintext file that reads
 
prompt
binary
lcd \docume~1\administrator\mydocu~1\rawdata\data
cd data
mget *.*
lcd \docume~1\administrator\mydocu~1\rawdata\datascp
cd ..
cd datascp
mget *.*
bye
 
Unfortunately, this seems to keep timing out.  I even tried using MoveIt Freely (http://www.standardnetworks.com/products/?category_number=6&subcategory_number=1) instead of the built-in Windows XP FTP client, and it didn't help.
 
Normally I just transfer files from the RT target using Internet Explorer (ftp://192.168.0.2) and I do not have any problems.  The Data directory contains about 3200 files in 13 MB.
 
Is there some way I can reconfigure the FTP server on the RT target that will allow this transfer to work better?  Or is there a much better alternative method of backing up the files that I am not aware of?  (Using LabVIEW to zip the files first would be neat, except that the RT target is only running LabVIEW 7.1.1, which does not have such functionality, if I am not mistaken.  Nor do I have the Internet toolkit.)

Message Edited by kehander on 07-28-2006 05:03 PM

Message 1 of 12
(7,740 Views)
Surely I'm not the first person who has wanted to do something like this?
0 Kudos
Message 2 of 12
(7,716 Views)

kehandar hello.

I am not very familiar with the script you have written, but some things you might try are:

1.) Are you able to apply the same automated script to a directory that has just a few files in it?
2.) Are you able to FTP using Internet Explorer?

Since it times out when you run the script, one thing you can try is backing up a smaller directory to see if it exhibits the same behavior.

The main thing that comes to mind in regards to automating file transfer between systems is using the FTP VIs in LabVIEW, but I believe you stated you do not have the Internet Toolkit.

Please keep us posted!

Efosa O.
NIAE

0 Kudos
Message 3 of 12
(7,687 Views)
Since you advocate it so strongly, I checked again, and it turns out I do have the Internet Toolkit. Still, it seems slightly overkill for something so trivial. I suppose I shall have to try that anyway.

And as I stated, I regularly copy files through FTP using Internet Explorer.
0 Kudos
Message 4 of 12
(7,683 Views)
Kehandar
 
I haven't seen this script method done before so thanks for posting. I think your idea should work just fine. I don't have an RT target but I do have an FTP server called CerberusFTP on my PC. So I used this server to pilot a script using your method
 
ftp -s:script.txt X.X.X.X
 
where script.txt is
 
root
 
pwd
prompt
binary
cd ftproot
mget *.*
bye
 
I found that the script missed the prompt command so I inserted a throw away command such as pwd. This could be why its not working because interactive is still on as it missed the prompt command.
 
I don't think the -user and -password are valid under XP so I would try your login into the script file like I have done.
 
FTP [-v] [-d] [-i] [-n] [-g] [-s:filename] [-a] [-w:windowsize] [-A] [host]
  -v             Suppresses display of remote server responses.
  -n             Suppresses auto-login upon initial connection.
  -i             Turns off interactive prompting during multiple file
                 transfers.
  -d             Enables debugging.
  -g             Disables filename globbing (see GLOB command).
  -s:filename    Specifies a text file containing FTP commands; the
                 commands will automatically run after FTP starts.
  -a             Use any local interface when binding data connection.
  -A             login as anonymous.
  -w:buffersize  Overrides the default transfer buffer size of 4096.
  host           Specifies the host name or IP address of the remote
                 host to connect to.
Notes:
  - mget and mput commands take y/n/q for yes/no/quit.
  - Use Control-C to abort commands.
Hope this helps....
 
David
0 Kudos
Message 5 of 12
(7,677 Views)
Thank you, that sounds like an interesting suggestion, Mr. Crawford. Unfortunately I did not get a chance to try it today, but hopefully tomorrow will work out better.
0 Kudos
Message 6 of 12
(7,661 Views)
For good measure I used this script:

[blank line]
[blank line]
pwd
prompt
pwd
binary
pwd
lcd \docume~1\administrator\mydocu~1\rawdata\data
pwd
cd data
pwd
mget *.*
pwd
lcd \docume~1\administrator\mydocu~1\rawdata\datascp
pwd
cd ..
pwd
cd datascp
pwd
mget *.*
pwd
bye


Unfortunately, the script still stopped after the first mget command and still wasn't finished an hour later. The hard drive activity light on the PXI was off the whole time.

Are there no advanced configuration options somewhere for the RT mode FTP server that I could try tweaking? Failing that, perhaps there is a Zip library available for LabVIEW 7.1 that works in RT mode?
0 Kudos
Message 7 of 12
(7,652 Views)

Have you tried to do all of your commands manually from inside a console window (cmd.exe)?

Do they work OK?

David

0 Kudos
Message 8 of 12
(7,646 Views)
Hmm. For some reason that's not working right now either. 😕

I'll try rebooting into XP mode and running a disk defrag. Perhaps that shall somehow have an impact on things.
0 Kudos
Message 9 of 12
(7,634 Views)
This might be a firewall issue.  The command line ftp that comes with Windows uses Active FTP mode.  In active mode, the FTP client (on your windows machine) opens a port, and the FTP server (on your RT target) connects to that port to send/receive files and directory transfers.  I think your firewall is probably blocking that connection back to your FTP client.

Explorer uses passive FTP mode.  In passive mode all connections are made from the client  machine to the server, and the firewall will not block those.  I suspect that the other FTP client that you tried also uses passive mode.

Some FTP clients allow you to choose whether you want to use active or passive mode, but I don't think the XP command line client gives you that option.  You could try disabling the firewall, adding c:\windows\system32\ftp.exe as an exception, or you could look for an FTP client that supports passive mode.  The FTP VIs in the internet toolkit do support passive mode - you just wire False to the "active" input on the get/put VIs.

-Chris
Message 10 of 12
(7,623 Views)