I tried this
s3cmd ls s3://somebucket/data/ | awk '{print $4}' | xargs -I %s s3cmd -v -c s3.cfg cp %s 's3://anotherbucket/data/' && s3cmd -c s3.cfg rm %s -v
it does not work, of course, because the second command (s3cmd rm
) is not treated as part of the xargs argument...
How can I do it?
Background is that the move operation of the s3cmd
in my case appears not to delete the source file, so I wanted to replace it with a copy and a delete, which appears to work.