Quantcast
Channel: Find and move with exclude - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 5

Find and move with exclude

$
0
0

I need to use find and mv together

requirement : Need to find all file *.xml but exclude deposit.xml and move it to another folder ( fairly simple)

My attempt :

mv `find ./*.xml '!' -type d | fgrep -v deposit.xml` ./Archive

This works perfectly fine if there are any files, If no files are present it throws below error

mv: missing destination file operand after `./Archive'
Try `mv --help' for more information.*

Viewing all articles
Browse latest Browse all 5

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>