graycloud
graycloud

Reputation: 1

Bash: how can I loop through a directory's files?

In Bash, what would a for _ in _ loop look like if I'm trying to loop through all files in a directory and preform a command on them?

Upvotes: 0

Views: 42

Answers (2)

Ôrel
Ôrel

Reputation: 7662

a simple for

for f in dir/*; do echo "Processing $f file.."; done

Upvotes: 0

Barmar
Barmar

Reputation: 782489

for file in *
do
    perform_command_on "$file"
done

Upvotes: 2

Related Questions