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

mod rewrite - Using "?" when rewriting the URL -

.htaccess: Transfer name to index.php if not directory public -

Admob integration with pygame in android -