User Tools

Site Tools


uphp:functions:findfirst

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
uphp:functions:findfirst [2017/03/06 12:44]
jeff
uphp:functions:findfirst [2021/09/13 05:57] (current)
Line 1: Line 1:
 ======findfirst====== ======findfirst======
 +
 <badge>WMPRO, WMMINI FW >= 1.0</badge> <badge>WMMEGA FW >= 2.0</badge> <badge>WMPRO, WMMINI FW >= 1.0</badge> <badge>WMMEGA FW >= 2.0</badge>
  
Line 5: Line 6:
  
 ====Description==== ====Description====
-<well size="sm"><html><span style="font-size:125%;color:green;">array + 
-<span style="color:black;"></html>[[findfirst]] +<well size="sm"><html> 
-<html>+<span style="font-size:125%;color:green">array 
-<span style="color:green;">string +<span style="color:black">findfirst ( 
-<span style="color:blue;">$pattern<span style="color:black;">, +<span style="color:green">string 
-<span style="color:green;">int +<span style="color:blue">$pattern<span style="color:black">, 
-<span style="color:blue;">$attributes +<span style="color:green">int 
-<span style="color:black;">)+<span style="color:blue">$attributes 
 +<span style="color:black">)
 </html></well> </html></well>
  
Line 18: Line 20:
  
 ====Parameters==== ====Parameters====
-<html><span style="color:blue;"><b>pattern</b><span style="color:black;"></html>:  Partial or full pattern such as *.* or *.cgi 
  
-<html><span style="color:blue;"><b>attributes</b><span style="color:black;"></html>:  Matching mask, leave at 255 to include allSee [[os:fat_file_system#attributes|FAT file attributes]] for more information.+<html><b><span style="color:blue">$pattern<span style="color:black"></b></html>:  Partial or full pattern such as *.* or *.cgi
  
-====Return Value==== +<html><b><span style="color:blue">$attributes<span style="color:black"></b></html>:  Matching mask, leave at 255 to include all. See [[software:os:fat_file_system#attributes|FAT file attributes]] for more information. 
-Array of the first matching file containing the following keys and values:+ 
 +====Return Values==== 
 + 
 +<html><b><span style="color:green">Array<span style="color:black"></b></html> of the first matching file containing the following keys and values:
  
 ^KEY^TYPE^VALUE^ ^KEY^TYPE^VALUE^
-|filename|<html><span style="color:green;">string</html>|Name of the file| +|filename|<html><b><span style="color:green">string</b></html>|Name of the file| 
-|attributes|<html><span style="color:green;">int</html>|[[os:fat_file_system#attributes|FAT file attributes]]| +|attributes|<html><b><span style="color:green">int</b></html>|[[software:os:fat_file_system#attributes|FAT file attributes]]| 
-|filesize|<html><span style="color:green;">int</html>|File size in bytes| +|filesize|<html><b><span style="color:green">int</b></html>|File size in bytes| 
-|timestamp|<html><span style="color:green;">int</html>|[[os:fat_file_system#timestamps|FAT timestamp of last save]]|+|timestamp|<html><b><span style="color:green">int</b></html>|[[software:os:fat_file_system#timestamps|FAT timestamp of last save]]|
  
 ====Example==== ====Example====
-List all files in the root directory:+ 
 +===List all files in the root directory===
  
 <code php> <code php>
 <pre><? <pre><?
-chdir("/"); //change to the root folder +  chdir("/"); // change to the root folder 
-$arr=findfirst("*.*",255-16); //get the first entry matching any file, excluding directories +  $arr=findfirst("*.*",255-16); // get the first entry matching any file, excluding directories 
-while ($arr) { +  while ($arr) { 
-  print($arr['filename']."\r\n"); +    print($arr['filename']."\r\n"); 
-  $arr=findnext(); //get another matching file +    $arr=findnext(); // get another matching file 
-}+  }
 ?></pre> ?></pre>
 </code> </code>
  
-====See Also====+====Also See==== 
 [[findnext()]] - Return next matching file information (after a findfirst) [[findnext()]] - Return next matching file information (after a findfirst)
  
-[[timefromfat()]] - Convert a FAT filetime to a native Linux timestamp+[[timefromfat()]] - Convert a FAT filetime to a Linux Timestamp
  
-[[strftime()]] - Format the passed time using the format string+[[strftime()]] - Format a Linux Timestamp using format <html><b><span style="color:green">string</b></html>
  
-[[chdir()]] - Change uPHP'current directory+[[chdir()]] - Change the current directory
  
 [[file_exists()]] - Check if a file exists [[file_exists()]] - Check if a file exists
  
-[[filesize()]] - Return the size of a file, or the number of unread bytes in a stream +[[filesize()]] - Return the size of a file, or the number of unread bytes in a stream or socket
- +
-[[uphp:control_structures:while]] - Flow control structure for a conditional loop+
  
uphp/functions/findfirst.1488804285.txt.gz · Last modified: 2021/09/13 05:56 (external edit)