I'd like to get output showing what has been copied by cp. The only problem is how to do it when I cp many files at a time. For instance, cp ./sourceDir/* $destinationPath/.

3 Answers 3


Like Lawrence has mentioned, you can use

cp -v

to enable "verbose" mode, which displays the files you copy. Something else that might be useful is

cp -v > foo

which will output the list of files to a file called foo. This is useful if you're going to copy a lot of files and you want to be able to review the list later.


cp -v enables verbose mode which displays what's being copied.


Check if your system has the -v option to cp.

If it doesn't, you can make a loop to show the file names and copy them one by one. This is not completely straightforward if you want to keep track of whether some copies failed.

for x in ./sourceDir/*; do
  echo "$x -> $destinationPath/${x##*/}"
  cp "$x" "$destinationPath/" || err=1
return $err

Alternatively, you might use a tool with many options such as rsync.

rsync -av ./sourceDir/ "$destinationPath/"

Going in the other direction, you might find it enough to see the expansion of the wildcard.

echo "Copying files:" ./sourceDir/*
cp ./sourceDir/* "$destinationPath/"

Or you might print a trace of shell commands:

set -x
cp ./sourceDir/* $destinationPath/
  • 1
    +1 for suggesting what to do if the -v option is unavailable. Dec 4, 2013 at 1:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .