LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

File permissions - same old story

Solved!
Go to solution

I've written an application in LabVIEW 8.6 that launches from CD. It copies a master Real-Time image (taken using the RealTime System Replication Tools) to the user's local PC temporary directory, then edits one of the files in that repository to suit the user's set-up (IP etc.), then flashes the image onto the RT system.

 

The problem I've got is - I cannot delete the temporary files when I'm finished because the files are all set to read only. Why read-only? Because they were copied from the CD, where they are all necessarily Read-only, and Windows copies that attribute across to the local PC files too. Now, the LabVIEW File Permissions primitive is useless. It won't let me change the read-only flag for the whole folder, just one file at a time. So consequently I cannot delete the folder of temporary files easily.

 

How can I change the attributes of a complete folder of files from read-only to writeable such that I can then go ahead and delete them? There are literallyhundreds of files here...

Message Edited by Thoric on 06-11-2009 03:40 PM
Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 1 of 13
(7,393 Views)
No matter. I'm simply recursively listing all files and folders and passing them into the File Permissions primitive within a loop. Unglamorous, but it works.
Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 2 of 13
(7,381 Views)
Solution
Accepted by topic author Thoric
Try "system exec.vi" and the attrib dos command http://www.computerhope.com/attribhl.htm


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
Message 3 of 13
(7,373 Views)

Hi there

 

LV 8.6 documentation for "Set Permissions Function" states:


Sets the owner, group, and permissions of the file or directory specified by path. This function does not work for files inside an LLB.

 

Which version is yours LV?

Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 4 of 13
(7,354 Views)
Hi Coq Rouge - I'm not able to check out your suggestion at the moment, but tell me, does it support recursive application of permissions? I need to set a whole folder of files.

Chris - I believe that supplying a folder path to the LabVIEW function only sets the permissions to the folder, not the contents. I need to change the hundreds of files that are inside the folder also.
Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 5 of 13
(7,327 Views)
yes you may use the /D or /S and *.* option


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
Message 6 of 13
(7,324 Views)

Fantastic. I'm not a massive fan of using System Exec with DOS based commands, but this will do me just fine 🙂

Thanks!

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 7 of 13
(7,306 Views)

I realise this is quite an old thread but I still couldn't find an elegant solution in the LabVIEW forum.

 

I like to try and store my application information the recommended way, in an ini file in the application public data section.

However, as a number of people have already pointed out, this doesn't work for another user logging in because the OS has only allowed write permissions to the original user.

The System Exec approach seems a bit to untidy to me, unprofessional maybe?

 

So yesterday I decided to do battle with MS Windows and get file premissions working in LabVIEW (using .NET).

 

Here is the result of my efforts, I hope it is useful to someone, even if just as example code of .NET for Windows in LabVIEW.

It adds the 'Everyone' identity to the file security and gives it full control.

 

I tried to put some meaningful documentation in there so if I ever have to go back to it I have some hope of understanding why it's doing what it is doing.

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
Message 8 of 13
(6,787 Views)

Well done to you on figuring this out. The beast that is the Microsoft permissions labyrinth is a real pain, I'm sure many will appreciate your efforts here! Smiley Very Happy

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 9 of 13
(6,758 Views)

very nice job, but in my case it is not fully working: I can only set permissions but not clear them 

 

0 Kudos
Message 10 of 13
(6,643 Views)