LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I set a file's deleting permission?

HI,

 

I would like to protect a .txt or .xls file from being erased by mistake. I have changed the Writing rights (attached file and works fine) but I can't find how to forbid the supressing of the file. Can this be done with Labview with windows XP?

 

Thanks a lot,

 

User

0 Kudos
Message 1 of 9
(4,340 Views)

Hi User,

did you see the "Set Permissions" function from the File I/O palette?

  

Edit: If this doesn't help, then you can change the owner of the file. Here is some Code.

 

 

Hope it helps.

Mike

Message Edited by MikeS81 on 05-04-2010 04:06 PM
0 Kudos
Message 2 of 9
(4,323 Views)

Hi Mike,

 

Thanks for your answer. In my attachment I am using the "Set Permissions" Vi but it can only set the writting permission to False when file is created but not forbid its supression, from what I have understood.

 

User

0 Kudos
Message 3 of 9
(4,307 Views)

What do you mean by "supression"?

 

Your subject line says you want to set the permissions for deleting a file.  I don't think you can do this.  If I look at the properties of the file from within Windows, the only options are to set the file as read only or not.

 

Is this a file located on a network drive?  (Your example shows a c:\ drive.)  A network drive has a much larger list of activities that can be allowed or denied.  However, that Set Permissions function doesn't look like it has the means to set any of those permissions.

 

Perhaps there is a way using a Windows .dll call to do this.

0 Kudos
Message 4 of 9
(4,286 Views)

Hi,

 

What I would like to do is to avoir deleting (suppressing?) the file by mistake. FOr the moment the VI I posted does only protect the file from being modified....

 

The file is in a folder on the C: disk

 

User

0 Kudos
Message 5 of 9
(4,269 Views)

So you want to avoid deleting a file.  (I'm going to assume that whatever you meant by "suppressing" was a bad translation to English.)

 

Looking deeper into this, I see that the more advanced file permissions are a part of the security tab in explorer (as opposed to the general tab).  That got me thinking of a command I had never really needed to use before.  Look up using "cacls" in a command prompt window.  When I did a cacls /? to look up help on my Vista machine, it said it was deprecated and said to use "icacls".

 

So look for help on either of those and you could feed them into a System Exec.vi function under Connectivity / Libraries and Executables palette.

 

There may be other ways to change the access control list  (cacls) then the command prompt way.  If there is, hopefully someone can point them out.

Message Edited by Ravens Fan on 05-04-2010 10:58 PM
0 Kudos
Message 6 of 9
(4,258 Views)

I wrote the two attached vis to help me set and get permissions in Windows XP.

 

The only problem is that the set permissions function from the palette stopped working in LabVIEW 2009.

 

Have a look at what I suggested in this thread as a work around. I wrote it to remove the read only attribute. You will need to invert the logic to set the file's read only attribute.

 

http://forums.ni.com/ni/board/message?board.id=170&view=by_date_ascending&message.id=495139#M495139

 

Message Edited by Troy K on 05-05-2010 01:36 PM
Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
Download All
0 Kudos
Message 7 of 9
(4,252 Views)

Oops, sorry, I think I attached the wrong version of my Set permissions vi.

The one I attached was after I started fiddling around with it trying to get it working again in LabVIEW 2009.

 

Here are the original vis (that worked in 8.6.1) if you're interested (8.6.1versions)

Message Edited by Troy K on 05-05-2010 01:50 PM
Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 8 of 9
(4,241 Views)
Wow, editing a post doesn't seem to work well from firefox? (or perhaps it's a combination of firefox and the proxy I'm sitting behind)
Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 9 of 9
(4,236 Views)