LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

zip and delete folder

I would like to programatically zip a folder then delete the folder. I can successfully zip the folder using the OpenG zip tools, but when i try to delete it in the same VI i get an error 6. This sparked me to use the NI zip tools, but this causes the same problem when i try to delete the folder. The funny thing is that I can manually delete the folder after the zipping VI has stopped execution. This made me think that the execution of the zipping VI has to be finished before the delete primitative is called. I then added some code to launch a separate VI with the VI.Run method that does the deleting. This method does not work either.

 

Does anybody have any idea on how to delete a folder after it has been zipped? I'm thinking of investigating other zipping softwares that have a command line interface but I figure I'd ask here too.

0 Kudos
Message 1 of 5
(4,057 Views)

Did you set the "entire hierarchy" input of the Delete function to True? If not, please read the documentation on that function. It will not delete non-empty folders, and it will generate an error (specifically error 6) if that input is not set to True, as it's False by default.

0 Kudos
Message 2 of 5
(4,045 Views)

I am using LabVIEW 7.1 so that input doesn't exist, but the folders are not empty when I try to delete them. I'll attach the code I have and a test folder. Notice how it archives the contents of the test folder based on the first word of the text files.

 

 

Download All
0 Kudos
Message 3 of 5
(4,010 Views)

The problem was that I was trying to delete folders that had files within them. I misread the help and thought that it wouldn't delete folders unless they had something in it. I now delete the contents of the folder before deleting the folder its self and now I do not get an error.

0 Kudos
Message 4 of 5
(3,990 Views)

I didn't find the LV14 'Help' for the 'Delete' function helpful, so here's some test results using LV14:

If the Dir contains a file, and 'entire hierarchy(F)?'=F, ===> 'Delete' throws Error 6.
If the Dir contains a file, and 'entire hierarchy(F)?'=T, ===> 'Delete' deletes the Dir without an error.

If the Dir contains a sub-folder, and 'entire hierarchy(F)?'=F, ===> 'Delete' throws Error 6.
If the Dir contains a sub-folder, and 'entire hierarchy(F)?'=T, ===> 'Delete' deletes the Dir without an error.

If the Dir contains nothing, and 'entire hierarchy(F)?'=F or T, ===> 'Delete' deletes the Dir without an error.

0 Kudos
Message 5 of 5
(2,903 Views)