in reply to Re: Run a script on every file in a directory
in thread Run a script on every file in a directory

Not quite right. Both bash versions will leave out the "hidden" files with names starting with a ., and they will process every other directory entry, not just ordinary files, but also special files like symlinks, directories, device nodes, pipes. The cmd for loop also skips files with the hidden bit set.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Replies are listed 'Best First'.
Re^3: Run a script on every file in a directory
by ikegami (Patriarch) on Jun 08, 2010 at 21:15 UTC

    More like insufficient information in the question, so I answered the typical case. Should the OP answer me the following questions and specify the target shell, I'll provide.

    • Should directory "." be included? (I assumed no)
    • Should directory ".." be included? (I assumed no)
    • Should other directories be included? (I assumed yes)
    • Should other non-plain files be included? (I assumed yes)
    • Should other hidden files be included? (I assumed no)
    • Should subdirectories be visited recursively? (I assumed no)