0

when attempting to copy a file inside a mounted directory, I got this message printed on my terminal:

cp: writing `file': Bad address

However, the copying operation is successfully executed, but I just want to delete this message (for a presentation purpose). any idea how to remove this warning (or error) ?

Stephan
  • 8,000
  • 3
  • 36
  • 42
TheForbidden
  • 1,533
  • 4
  • 22
  • 30

1 Answers1

0

You could redirect errors to /dev/null or to a log file, like this :

cp a b 2>/dev/null

or

cp a b 2>errors.log
Eric Citaire
  • 4,355
  • 1
  • 29
  • 49
  • I meant programatically (Java) ? – TheForbidden May 22 '13 at 14:55
  • Why are you using a command line to copy a file in Java ? You can do it using Streams or even better, using a library like [commons-io](http://commons.apache.org/proper/commons-io/javadocs/api-release/org/apache/commons/io/FileUtils.html) – Eric Citaire May 22 '13 at 15:55