NI Home > Community > NI Discussion Forums

LabVIEW

Reply
Member
Briton
Posts: 47
0 Kudos

Deleting set of files with the ftp-VI's

Hi

I need to now how I can delete a direktory including the files in it, with the ftp-VI's from the internet connectivity toolset.
I have used the FTP[dele].VI and the FTP[RMD]to delete single files and direktory.
I have been told that the UNIX command "rm -rf direktoryname" should delete the specified direktory and the contens of files.
I have tried to use this comman with the FTP Command.vi, but it didn't work.
Can anybody help me ?
Member
Cyril
Posts: 178
0 Kudos

Re: Deleting set of files with the ftp-VI's

Hi,

I may not be correct but directories that still contain files or subdirectories typically cannot be deleted using FTP software. You must first delete the files located in the directory you want to remove. As far as the Internet Toolkit goes, I dont really know but I know that clients like WS-FTP and the new FTP.NET component give you that option.

Looping through the folders and files seems to be the way to do it with labview. You could probably use this link as a starting point and modify it for FTP commands:
http://sine.ni.com/apps/we/niepd_web_display.DISPLAY_EPD4?p_guid=B123AE0CBC23111EE034080020E74861&p_node=DZ53008&p_submitted=N&p_rank=&p_answer=&p_source=External

One thing to be aware of is that sometimes the directory will seem to be empty but it really isn't. It has at least one file under it somewhere that begins with a period (.) so that it is hidden or invisible to the regular 'ls' command.
In order to see and delete these hidden files,

1) Get a shell prompt and type:
ls -la /Dir1/Dir2/dirname

where /Dir1/Dir2/dirname is the full path to the directory that you are trying to delete. Doing that will show you all the hidden files inside the directory. You can then delete these hidden files using the standard commands.

Hope this helps
Cyril Bouton
Active LabVIEW Developper