1
votes

I'm trying to copy/move/sync the files from local directory to S3 using the AWS Command-Line Interface (CLI).

I was able to successfully upload files for the very first time to the S3 bucket but when I try to run the same command again for uploading the second time it fails to upload. The command doesn't throw any error.

Here is the command which I ran for moving the files.

aws s3 mv --recursive my-directory s3://my-files/

For instance, I had files file1.pdf, file2.pdf and file3.pdf.

If I delete file2.pdf from the s3 bucket and try to copy the file again using cp or sync or mv. It won't be uploading the file back again to s3 bucket.

AWS CLI Version: aws-cli/1.15.10 Python/2.6.6 Linux/2.6.32-642.6.2.el6.x86_64 botocore/1.10.10

Any thoughts?

1
What do you mean by "uploading the second time"? The mv command copies the files, then deletes them. (It does not delete the directories, it only deletes the files.) If you were to run it a second time, there are no files to move, so nothing happens -- this should be expected. Or did you put new files in my-directory before running the command again? - John Rotenstein
I have been using cp, mv & sync to have the file updates between the s3 and my local. I have deleted a bunch of files from the s3 bucket. When I try to cp files back again it would run the command successfully but doesn't copy/upload anything to s3. - Teja
That's different to what you're asking in the question. Feel free to Edit the question and provide a simplified example of what's happening. Preferably, try to reproduce the problem with a minimal example that we can try to reproduce and diagnose. Also, make sure you're using the latest version of aws-cli just to be sure. (At the time of writing, it appears to be aws-cli/1.15.10) - John Rotenstein
@JohnRotenstein I had updated my question giving more specific examples and added the AWS CLI version details. - Teja
What do you mean by "copy the file again"? If you run mv, it copies the file and then deletes the local file. If you try to move/copy it again, it isn't available locally, so there is nothing to move/copy. - John Rotenstein

1 Answers

1
votes

Initially I ran the aws s3 mv --recursive my-directory s3://my-files/ which transfers the files and deletes them from the local directory. Only the files were deleted, folders still exist. Files didn't exist in those folders so the subsequent cp & sync commands didn't work.