LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to delete a directory in Lab Windows/CVI?

I require to delete folders which contain many sub-folders and files in Lab Windows/CVI version 6. How can this be done efficiently as the function 'DeleteDir' will only delete a directory if it is empty to start with?  
0 Kudos
Message 1 of 9
(6,143 Views)

You could try something along the following lines:

    system ("rmdir /S /Q dir_tree_to_remove");

JR

0 Kudos
Message 2 of 9
(6,135 Views)
Hi,
Are you asking how you would use something like MS-DOS Commands To Delete Directories In a LabWindows/CVI Project?
If so, from the command line, type:

 C:\> cmd.exe /C rmdir /S /Q c:\test

To use this MS-DOS command from a CVI program, use the following line in your code:
status = LaunchExecutableEx ("cmd.exe /C rmdir /S /Q C:\\test", LE_HIDE, NULL);

Whereby "test" is the direcory

I hope this helps!

Kirtesh Mistry
Applications Engineer
NI UK & Ireland

0 Kudos
Message 3 of 9
(6,097 Views)
Maybe I can use this tip, thanks.
0 Kudos
Message 4 of 9
(6,046 Views)
Thanks, I got it working now! Well in XP anyway not sure what it would do in win98.
0 Kudos
Message 5 of 9
(6,016 Views)


 


@Stu_B wrote:
Thanks, I got it working now! Well in XP anyway not sure what it would do in win98.

You would have do exactly the same: system and LaunchExecutable are present in CVI from several version on, so you could find them in the version of the IDE compatible with Win9x. rmdir is a system command that if I'm not wrong is present from DOS 5 or so...


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 6 of 9
(6,000 Views)

Hello all,

I'm trying to do the same thing. Problem is: when the directory I would like to remove is in the Program Files folder, the My Documents folder, or any other folder containging a space character, the cmd.exe doesn't understand the command. Seems like it cannot handle directory names with spaces...

0 Kudos
Message 7 of 9
(5,837 Views)

If you surround the directory path name which contains spaces with quotes, this should still work. Do you have the correct file permissions to alter the Program Files structure? - IIRC this is protected and needs administrator rights to manipulate.

JR

Message Edited by jr_2005 on 01-15-2007 11:08 AM

Message 8 of 9
(5,834 Views)
OK, the quote thing seems to do the trick. Thanks a lot, JR Smiley Wink
0 Kudos
Message 9 of 9
(5,826 Views)