I have a daily script to sync files to S3 bucket in AWS :
cd "C:\ProgramData\Console\Patches" & aws s3 sync . s3://distribution/Patches
I want it so that the outputs of the script will be saved to a new log file, for example: C:\Logs
.
Which command do I need need to add?
CodePudding user response:
You can just redirect the output to a file.
cd "C:\ProgramData\Console\Patches" & aws s3 sync . s3://distribution/Patches >> aws-patches.log 2>&1
>
creates a new file every time
>>
creates or appends
2>&1
redirects error-out to std-out, so you also get the errors in the log