From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to change file attributes with LV6?

Sometimes I have to work with files that are copied fron CDs and they are read-only files default. I'd like to change this attribute through LV6, is it possible?
0 Kudos
Message 1 of 12
(2,807 Views)
If you are working under windows, one way could be using System exec.vi and calling attrib command.
Hope this helps
Message 2 of 12
(2,807 Views)
Yes, I am working under windows, but please could you explain a little bit more how to do it?
0 Kudos
Message 3 of 12
(2,807 Views)
Place system exec.vi in your diagram, and wire in the following string to disable read only attribute:
attrib -r path
being path the path to the file you want. To do the inverse use + instead of -.
If you want to change the file, just use a concatenate string function.
Hope this helps
0 Kudos
Message 4 of 12
(2,807 Views)
U have to use the Communication\System Exec.vi

Then U make a string saying "attrib -R" (just write: "help attrib" in a
Command window, U will se that it vil remove the readonly atribute)
concatonate this with U'r path to the file...
fx.
attrib -R C:\temp\data.txt

/Klaus

"Javilon" wrote in message
news:506500000008000000072D0000-1002247793000@exchange.ni.com...
> Sometimes I have to work with files that are copied fron CDs and they
> are read-only files default. I'd like to change this attribute through
> LV6, is it possible?
Message 5 of 12
(2,807 Views)
I have just tried it in a new vi but it never finishes the execution.
I have just inserted System Exec.vi and wire 'attrib +r c:\(path of file)' to the command line. It never ends and I have to end task labview externally.
D u have any idea why that happens? Should I wire anything else?
0 Kudos
Message 6 of 12
(2,807 Views)
First of all be sure you include the file name, for example: attrib -r c:\abc\abc.txt
Works correctly here, in LV 5 and WinNT 4. Which LV and Win version are you using?
In the other hand, there's an utility called LVWUtil32 in NI site that has a powered version of system exec, you could try with it.
Hope this helps
0 Kudos
Message 7 of 12
(2,807 Views)
See the answers to this previous post:

Previous Post

Brian
0 Kudos
Message 8 of 12
(2,807 Views)
Javilon wrote:
>
> Sometimes I have to work with files that are copied fron CDs and they
> are read-only files default. I'd like to change this attribute through
> LV6, is it possible?

Javilon,
I've got a program you can download that handles this for Windows. I
wrote it specifically to remove the Read-Only attribute from an entire
hierarchy when copying things from CD's, but you can get into the guts
and make it do whatever you want. It works by making calls to the
Windows API.
To get it, go to www.originalcode.com, then to Example Code,
Utilities, and Program Downloads, then look for the UtilityVIs.llb.

Regards,
Dave

-------------------------------------------------------------
David Thomson 303-499-1973 (voice and fax)

Original Code Consulting dthomson@originalcode.com
www.originalcode.com
National Instruments Alliance Program Member
-------------------------------------------------------------
Research Scientist 303-497-3470 (voice)
NOAA Aeronomy Laboratory 303-497-5373 (fax)
Boulder, Colorado dthomson@al.noaa.gov
-------------------------------------------------------------
Message 9 of 12
(2,807 Views)
Thank you very much. It works perfectly well and it's very useful.
Thanks again,
Javi
0 Kudos
Message 12 of 12
(2,623 Views)