Artificial intelligent assistant

Keeps on getting message files are identical using find Whenever I enter this: find . -type f -name 'diag*' -mtime +30 -exec mv {} temp_diag \; in SunOS I always get this message mv: ./temp_diag/diagnostic.log.68.gz and temp_diag/diagnostic.log.68.gz are identical mv: ./temp_diag/diagnostic.log.37.gz and temp_diag/diagnostic.log.37.gz are identical mv: ./temp_diag/diagnostic.log.18.gz and temp_diag/diagnostic.log.18.gz are identical The command I used just works fine but am just concerned with what the messages mean.

When using this command it will go from the current path down. So you have something like this:


dir1
dir1/temp_diag
dir1/temp_diag/file1


You are running your commmand from inside `dir1` and find enters into dir1/temp_diag and executes


mv ./temp_diag/file1 temp_diag/file1


You are actually telling the command to move the file to itself.

**UPDATE:** If you don't have any subdirs with files then you can add the option to find of maxdepth 1. So:


find . -type f -name 'diag*' -maxdepth 1 -mtime +30 -exec mv {} temp_diag \;


or if you have subdirs but don't want to include temp_diag then:


find . -path ./temp_diag -prune -o -print -type f -name 'diag*' -mtime +30 -exec mv {} temp_diag\;

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy fa7893e2fe7b0f90ef9c6615f262ffa0