I have list of files in a certain directory and need to upload it to remote location in s3cmd
. It outputs the each file uploaded and I need to move those file to a local backup directory. I know how to get the file name correctly (alone with path). How can I move the file in a single command (not using a shell script).
I use the following command, But it don't expand the grep
pattern correct to feed mv
command.
$ s3cmd sync /home/siri/ s3://project/test/ 2> /dev/null | grep -Po '/home/siri/\w+\.json' -exec mv {} /home/siri/backup \;