bash - How to avoid 'are the same file' warning message when using cp in Linux? -


i'm trying copy files 1 directory another. using command

find "$home" -name '*.txt' -type f -print0 | xargs -0 cp -t $home/newdir 

i warning message saying

cp: '/home/me/newdir/logfile.txt' , '/home/me/newdir/logfile.txt' same file

how avoid warning message?

the problem try copy file itself. can avoid excluding destination directory results of find command this:

find "$home" -name '*.txt' -type f -not -path "$home/newdir/*" -print0 | xargs -0 cp -t "$home/newdir"  

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -