LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

System exec rmdir doesn't work

I am having an odd issue and was wondering if anyone out there had some ideas. I am using LabVIEW 6.1 on Windows 2000.

I need to delete a folder programatically from LabVIEW. This folder will have folders and files inside of it when it needs to be deleted. (I am trying to delete old data archives automatically.) I build the path of the directory using the "Build Path" VIs, then I turn the path into the string and concatinate it with the string constant "rmdir /S /Q ", then send the whole string into the system exec VI. When I execute the code, the directory does not get deleted; however, when I copy the string that I send to system exec.vi into cmd.exe the directory is actually deleted.

Is there some sort of safeguard in system exec that is stopping this command from working? If so, does that mean that the only way to accomplish my goal from LabVIEW is to go through and delete every individual file then all of the folders?

Thanks for your help.
0 Kudos
Message 1 of 15
(3,444 Views)
Hi,

Please find attached the example of using System Exec.vi

Regards,
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
Message 2 of 15
(3,438 Views)
Alternatively, I had this VI downloaded somewhere (I believe it was from the Code Library) which might be useful to you.

PS: Anyone who remember where this VI is from, please kindly advise 🙂
Thanks to the creator!

Cheers!
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
Message 3 of 15
(3,435 Views)
I can't open the VI since it is in 7.0 and I am using 6.1. If someone could convert this down I would appreciate it.
0 Kudos
Message 4 of 15
(3,432 Views)
I will give this VI a try, thank you.
0 Kudos
Message 5 of 15
(3,433 Views)
Hi, please find attached of version LV6.1
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
0 Kudos
Message 6 of 15
(3,438 Views)


@Ian fung wrote:
Alternatively, I had this VI downloaded somewhere (I believe it was from the Code Library) which might be useful to you.

PS: Anyone who remember where this VI is from, please kindly advise 🙂
Thanks to the creator!

Cheers!




The File package of the OpenG Toolkit also contains a VI "Delete Recursive.vi". You can download OpenG Toolkit packages through the OpenG Commander at
http://www.openg.org/content/category/4/67/45/

Rolf Kalbermatter
Rolf Kalbermatter
My Blog
Message 7 of 15
(3,431 Views)
The earlier posted VI (deleteALL.vi) takes a whole lot of CPU to get the job done. (This is why I was hoping to use the system exec, as I was guessing that windows could more efficiently delete the folders than going through and deleting each individual file.) The folder I am trying to delete has as many as 31 subfolders, with as many as 100 files in each of those subfolders.

Message Edited by Sirin on 06-24-2005 10:14 AM

0 Kudos
Message 8 of 15
(3,424 Views)
But Windows really just does the same. The low level Windows API doesn't allow deleting a directory which is not empty, so what the higher level functions do is enumerating recursively all files and directories in a directory and deleting them one by one too.

The VI you have probably does recursive operation by using VI server but that is an extremely costly operation in LabVIEW. Better is to build a stack of filenames to delete and directory names to enumerate and go down in the hierarchy until there is nothing more left. The OpenG VI does it in that way and is IMO not very slow.

Rolf Kalbermatter

Message Edited by rolfk on 06-24-2005 10:22 AM

Rolf Kalbermatter
My Blog
0 Kudos
Message 9 of 15
(3,419 Views)
Hi Rolf,

Thanks! That's COOL 🙂

Cheers!
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
0 Kudos
Message 10 of 15
(3,405 Views)