Walk a directory/Non-recursively: Difference between revisions

(→‎{{header|Python}}: compatibility with Python 3)
Line 1,033:
end
end</lang>
=={{header|Run BASIC}}==
<lang runbasic>files #g, DefaultDir$ + "\*.jpg" ' find all jpg files
if #g HASANSWER() then
count = #g rowcount() ' get count of files
for i = 1 to count
if #g hasanswer() then 'retrieve info for next file
#g nextfile$() 'print name of file
print #g NAME$()
end if
next
end if
wait</lang>
FILE ACCESSOR methods
 
#handle HASANSWER() - Return non-zero if the file accessor has at least one resulting row.
#handle ROWCOUNT() - Return the number of rows returned.
#handle NEXTFILE$() - Advance to the next row and return a comma delimited string for the next file (name, size, date, time, directory flag).
#handle NEXTFILE$([delimExpr$]) - Like NEXTFILE$() but you get to specify the delimiter instead of a comma.
#handle NAME$() - Return the name of the current file row.
#handle SIZE() - Return the size of the current file row.
#handle DATE$() - Return a string containing a formatted date for the current file row.
#handle TIME$() - Return a string containing a formatted time for the current file row.
#handle ISDIR() - Return non-zero if the current file row represents a directory instead of a file.
#handle RESET() - Reset the file accessor back to the beginning so you can read through them again.
#handle DATEFORMAT(template$) - Set the date format using a "mmm dd, yyyy" style template$.
#handle TIMEFORMAT(template$) - Set the time format using a "hh:mm:ss" style template$.
#handle ISNULL() - Returns zero (or false)
#handle DEBUG$() - Returns the string "Files"
 
OUTPUT:
<pre>
button.JPG
circuitbanner1.JPG
circuitbanner2.JPG
copy.jpg
homecomputerbanner1.JPG
mandelbrot.jpg</pre>
 
=={{header|Rust}}==
Anonymous user