0

When i type command

cp notExistsFile.txt ~/Desktop/ 

its gives an error: "cp: cannot stat `notExistsFile.txt': No such file or directory"

is "cp command" have any option such that if file doesn not exits it wont give any error , it just skip it.

i am performing this from shell script

1
  • you can redirect the stderror message to /dev/null ? Commented Mar 8, 2013 at 4:10

1 Answer 1

2

You can always redirect the standard error to /dev/null

cp notExistsFile.txt ~/Desktop/ 2>/dev/null 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.