Desmond
09-24-2003, 02:19 PM
<HTML> <HEAD> <TITLE>Spanning Content Across Multiple CD's</TITLE> </HEAD> <BODY> <h3>Setting File Attributes For More Than One File</h3> <b>Document ID: IR10009</b> <hr> The information in this article applies to: <ul> <li>AutoPlay Media Studio 5.0 Professional Edition</li> </ul> <hr> <h3>SUMMARY</h3> <p>This article describes how to set the attributes of multiple files at the same time. </p> <h3>DISCUSSION</h3> <p>AutoPlay Media Studio 5.0 has a File.SetAttributes action to set the attributes of a file. If you want to set the attributes of many files at once, you need to perform that action multiple times. An easy way to do this is to store the list of files in a table, and then cycle through that table using a for loop. Each pass through the loop would set the attributes for one of the files.</p> <p>An easy way to create a table full of file paths is to use the File.Find action. The File.Find action returns a table containing a list of all the files which match a specific pattern.</p> <p>As an example, let's set all of the .exe files in the root folder of the C: drive to read-only:</p> <ol style="LIST-STYLE-TYPE: decimal" type="1"> <li>Insert the following script into an event in your project:<code><pre>files_to_change = File.Find("C:\\","*.exe");
<br />-- loop through the files_to_change table
<br />-- and set each file's attributes one at a time
<br />for index, filename in files_to_change do
<br /> File.SetAttributes(filename,{ReadOnly=true});
<br />end</pre> </code> </li> </ol> <h3>MORE INFORMATION</h3> <p>For more information please see the following topics in the AutoPlay Media Studio 5.0 help file:</p> <ul> <li><b>Program Reference | Actions | File | File.SetAttributes</b></li> </ul> <p> KEYWORDS: Find, Attributes, Read </p> <hr> <FONT SIZE=1> Last reviewed: September 24, 2003<br> Copyright © 2003 <A HREF="http://www.indigorose.com" target="blank">Indigo Rose Corporation</a>. All rights reserved.<br> </FONT> </BODY> </HTML>
<br />-- loop through the files_to_change table
<br />-- and set each file's attributes one at a time
<br />for index, filename in files_to_change do
<br /> File.SetAttributes(filename,{ReadOnly=true});
<br />end</pre> </code> </li> </ol> <h3>MORE INFORMATION</h3> <p>For more information please see the following topics in the AutoPlay Media Studio 5.0 help file:</p> <ul> <li><b>Program Reference | Actions | File | File.SetAttributes</b></li> </ul> <p> KEYWORDS: Find, Attributes, Read </p> <hr> <FONT SIZE=1> Last reviewed: September 24, 2003<br> Copyright © 2003 <A HREF="http://www.indigorose.com" target="blank">Indigo Rose Corporation</a>. All rights reserved.<br> </FONT> </BODY> </HTML>