Chris
Chris

Reputation: 944

Unable to parse folder using Bash script

I am trying to write a bash script that will execute 1 Linux command (exiftool) for each file in a certain folder in a for loop.

Example of how to run this comand: exiftool /Users/user1/Documents/recovered/recup_dir.4/file_1.jpeg

Here is what I managed to do:

for i in /Users/user1/Documents/recovered/recup_dir.4
  do
    exiftool i
done

The error I got is:

File not found: i.

What I am doing wrong?

Upvotes: 0

Views: 60

Answers (2)

l'L'l
l'L'l

Reputation: 47169

You could likely use the find command to do this:

find /path/ -type f -maxdepth 1 -exec exiftool {} \;

http://linux.die.net/man/1/find

Upvotes: 1

Cyrus
Cyrus

Reputation: 88654

Try this:

for i in /Users/user1/Documents/recovered/recup_dir.4/*
do
  exiftool "$i"
done

Upvotes: 2

Related Questions