Warning using 'find'.


 
Thread Tools Search this Thread
Operating Systems OS X (Apple) Warning using 'find'.
# 8  
Old 03-25-2017
It is a - quite common - misconception to think that files/directories which names start with a dot are somehow special. They are not. In fact the only "special treatment" they receive is by the ls-command which does not display them as long as the option -a (display them anyway) is not given.

For all other commands (including find) directories and/or filenames starting with a dot a just as normal as all the others. If you want to exclude them from your result set you have to take specific precautions to filter them out. For the same reason:

Code:
rm ..

might not do what you wanted/expected it to do, but syntactically the command is OK and - given the right privileges - will do what it is supposed to do (which, again, might not be what you wanted, but that is another problem).

I hope this helps.

bakunin
# 9  
Old 03-25-2017
In addition to ls, hidden files (i.e., files with a <period> as the first character of their name) are not found using the asterisk in the shell as a filename matching pattern unless you explicitly include <period> as the first character in the pattern. For example:
Code:
echo 'unhidden files:'
printf '"%s"\n' *
printf '\n\nhidden files:'
printf '"%s"\n' .*

prints two distinct sets of files
Login or Register to Ask a Question

Previous Thread | Next Thread

2 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

find command giving incomplete sentence warning

Hi , I am adding a line in my shell scripts to delete all the old directory with the below command. On running this command it is coming out with the message find: incomplete statement find /ersdg3/ERS/ERS_INPUT_LOGS/RIO/rio_archive -type d -mtime +47 -exec rm -rf {} What is wrong or... (3 Replies)
Discussion started by: guddu_12
3 Replies

2. Solaris

Jumpstart -- Warning: Could not find matching rule in rules.ok

I just setup a new jumpstart server, and I'm having problems with rules.ok errors. I'm coming up blank after many Google searches, forum searches, etc..... This is the error I receive: Skipped interface e1000g1 Attempting to configure interface e1000g0... Configured interface e1000g0... (0 Replies)
Discussion started by: christr
0 Replies
Login or Register to Ask a Question