Worm
03-04-2004, 03:07 PM
This is a function to set the ReadOnly attribute to false on all files in folder and it's subfolder. Useful when you've copied files from a CD to the hard drive.
Sample Call
UndoReadOnly("C:\Program Files\My App")
Global Function
function UndoReadOnly(sFolder)
local n;
local m_File;
--find all files in the passed folder
m_tblFiles = File.Find(sFolder, "*.*", true, true, nil)
if m_tblFiles ~= nil then
--setup the attribute table
attrib = {};
attrib.ReadOnly = false;
--enumerate table
for n, m_File in m_tblFiles do
--set attribute
File.SetAttributes(m_File, attrib);
end
end
--clean up
attrib = nil;
m_tblFiles = nil;
end
Sample Call
UndoReadOnly("C:\Program Files\My App")
Global Function
function UndoReadOnly(sFolder)
local n;
local m_File;
--find all files in the passed folder
m_tblFiles = File.Find(sFolder, "*.*", true, true, nil)
if m_tblFiles ~= nil then
--setup the attribute table
attrib = {};
attrib.ReadOnly = false;
--enumerate table
for n, m_File in m_tblFiles do
--set attribute
File.SetAttributes(m_File, attrib);
end
end
--clean up
attrib = nil;
m_tblFiles = nil;
end