09-16-2015 06:24 PM
I'm using the VI attached "programmatic FTP file transfer.vi" to move log files from a linux achine to my local machine using FTP. ( it works great)
After the transfer is complete i want to delete the files from my linux machine,
I'm using labview 2014.
I do not see a labview FTP delete multple vi
I already have the list of files and paths i want to delete in a array/cluster.
Any ideas ?
thanks,
James
Solved! Go to Solution.
09-17-2015 03:19 AM
Looking at the FTP functions in LV2013, you are correct that there is no 'delete' function for a remote file deletion.
My suggestion would be to look through the VIs (for me at least, they are unlocked) and you should be able to create some new VIs which do the delete using the intermediate FTP functions. FTP is essentially a string based protocol so you just need to modify the part that sends the retrieve command to send the delete command instead.
Be careful that you don't overwrite the functions in the NI library though!
09-17-2015 03:30 AM
Open up the FTP Retrieve Multiple VI, and you'll see it's just a for loop wrapper around a low level FTP RETR command. You can do the exact same thing, but use FTP [DELE].vi located in vi.lib\FTP\ftp1.llb to delete multiple remote files.
I've attached a quick example, but it's untested!
09-22-2015 12:46 PM
Hello Michael,
Interserting your example code at the end of my code seems to work great!!
However my code now copys and deletes all the log files in the debian directory even the ones that are still being written to by my software program.
I assumed the unbundle by name "file" selection in my code would only copy accross files which have a file extension. ( but it copys all files)
Log files which are still being created by my software so not have a ".log" extension yet.
I want to filter my FTP file specification to only retrieve and delete files with a .log extension.
Any ideas ?
thanks,
James.
09-22-2015 09:02 PM
I think you've answered your own question, in that you need to filter the file listing for files which contain a .log extension. This can be done by using the string Match Pattern VI in the file selection loop.
If you specify a regular expression of log or more accurately \.log$ (which looks for .log at the end of a string), it will return an offset of the matched string. If there's no match it will return a -1. So you can check if the matched offset is greater than or equal to zero (ie. there is an .log extension), and then logically AND that with the check for file type.