(The lowercase letter ``ell''.) List in long format. (See below.)
If the output is to a terminal, a total sum for all the file sizes is
output on a line before the long listing.
Recursively list subdirectories encountered.
Include directory entries whose names begin with a dot (.).
Reverse the order of the sort to get reverse lexicographical order or
the oldest entries first (or largest files last, if combined with sort
by size
Sort by time modified (most recently modified first) before sorting
the operands by lexicographical order.
Enable colorized output. This option is equivalent to defining
CLICOLOR in the environment. (See below.)
Use time of last access, instead of last modification of the file for
sorting (-t) or long printing (-l).
Output is not sorted. This option turns on the -a option.
This option is only available for compatibility with POSIX; it is used
to display the group name in the long (-l) format output (the owner
name is suppressed).
Directories are listed as plain files (not searched recursively).
- [ ] lexicographicly
- [ ] lexicographicly reversed
- [ ] modified time
- [ ] modified time reversed
- [ ] access time
- [ ] access time reversed
- Parse options
- Sort arguments
- List files arguments
- display
- replace the argument by NULL
- List directory arguments
touch -t 999912312459 future ls -lt
mkdir a ln -s a b rm -rf a
EÉcrire un programme qui utilise les fonctionsopendir
, readdir
et
closedir
pour ouvrir un répertoire et lister les noms de ce qu’il contient sur
la console.
$>mkdir -p toto/tyty
$>touch toto/{tata,titi,tutu}
$>./ft_list_dir toto
tata
titi
tutu
tyty
$>
stat
pour obtenir des informations sur ce fichier et les afficher
à l’écran.
$>./ft_inspect_file un_fichier_de_ouf
Nom: un_fichier_de_ouf
Type: Fichier
Modes: rwxr-xr-x
Nombre de liens: 1
Proprietaire: zaz
Groupe: staff
Taille: 2142 octets
Date de derniere modification: Sep 17 23:42
$>
Vous allez devoir utiliser plusieurs fonctions, données en début de ce document,
afin d’interpréter les informations renvoyées par stat
.
- Errors
- Non directories
- Directories
$ ls test/ Makefile INVALID ana
ls: INVALID: No such file or directory
ls: ana: No such file or directory
Makefile
test/:
chmod000 dir error.sh getopt.sh list_dir symlink_dir
- Test options
- Order operands based on their type
- Print the result