« Commandes BASH » : différence entre les versions

Ligne 135 : Ligne 135 :


=== Compter le nombre de fichiers dans un répertoire ===
=== Compter le nombre de fichiers dans un répertoire ===
<syntaxhighlight lang="bash" line copy>
<syntaxhighlight lang="bash" copy>
find /dossier/path/etc -maxdepth 1 -type f | wc -l
find /dossier/path/etc -maxdepth 1 -type f | wc -l
</syntaxhighlight>
</syntaxhighlight>


=== Compter le nombre de fichiers dans un répertoire selon son extension ===
=== Compter le nombre de fichiers dans un répertoire selon son extension ===
<syntaxhighlight lang="bash" line copy>
<syntaxhighlight lang="bash" copy>
find /dossier/path/etc -name '*.MOV' -type f -printf '.' | wc -c
find /dossier/path/etc -name '*.MOV' -type f -printf '.' | wc -c
</syntaxhighlight>
</syntaxhighlight>