New answers tagged dot-files
Other way is for eachfile in /mnt/thara/[^.]*
Or very simply.. ls -l | egrep -v "^\." or to iterate all directories showing filenames: ls -R | egrep -v "^\."
you can use find command like this : for file in $(find /mnt/thara/ -type f \( ! -iname ".*" \)) ; do ---something $file--- ; done`
The normal behavior of bash is to do not look to the hidden files when using for. But this behavior can be changed with shopt command. To enable the scanning for hidden files with "*": shopt -s dotglob To disable the scanning for hidden files with "*" (default behavior) shopt -u dotglob So try a script like this : shopt -u dotglob for eachfile in /...
I agree with the comment about the dotglob shell option. If it is unset, the behavior of the for loop is the one expected: utente@computer:/tmp/test$ shopt | grep dotglob dotglob off Let a, b, and c are normal files; .hidden1 and .hidden2 hidden files: utente@computer:/tmp/test$ touch a b c .hidden1 .hidden2 utente@computer:/tmp/test$ ls -al ...
Top 50 recent answers are included