Contents
How do you loop through a directory in Linux?
To loop through a directory, and then print the name of the file, execute the following command: for FILE in *; do echo $FILE; done.
How do I loop a directory in bash?
The syntax to loop through each file individually in a loop is: create a variable (f for file, for example). Then define the data set you want the variable to cycle through. In this case, cycle through all files in the current directory using the * wildcard character (the * wildcard matches everything).