How to resolve the algorithm Unix/ls step by step in the Run BASIC programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Unix/ls step by step in the Run BASIC programming language
Table of Contents
Problem Statement
Write a program that will list everything in the current folder, similar to:
The output must be sorted, but printing extended details and producing multi-column output is not required.
For the list of paths:
When the program is executed in /foo
, it should print:
and when the program is executed in /foo/bar
, it should print:
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Unix/ls step by step in the Run BASIC programming language
Source code in the run programming language
files #f, DefaultDir$ + "\*.*" ' RunBasic Default directory.. Can be any directroy
print "rowcount: ";#f ROWCOUNT() ' how many rows in directory
#f DATEFORMAT("mm/dd/yy") 'set format of file date or not
#f TIMEFORMAT("hh:mm:ss") 'set format of file time or not
count = #f rowcount()
for i = 1 to count ' loop thru the row count
print "info: ";#f nextfile$() ' file info
print "name: ";#f NAME$() ' Name of file
print "size: ";#f SIZE() ' size
print "date: ";#f DATE$() ' date
print "time: ";#f TIME$() ' time
print "isdir: ";#f ISDIR() ' 1 = is a directory
next
You may also check:How to resolve the algorithm Mandelbrot set step by step in the Delphi programming language
You may also check:How to resolve the algorithm Compound data type step by step in the Maple programming language
You may also check:How to resolve the algorithm Totient function step by step in the FreeBASIC programming language
You may also check:How to resolve the algorithm Binary digits step by step in the PL/I programming language
You may also check:How to resolve the algorithm Scope modifiers step by step in the AutoHotkey programming language