'Log errors after running robocopy command
I am running a robocopy command to copy files from one folder to another like below -
"Robocopy source destination filename"
Some files are not getting copied although they are present at source. How to log those files in a log file?
Solution 1:[1]
robocopy /?
is the help for the utility
One of the options is /LOG
, wherein you can log the output to a file.
/V
is verbose which will show skipped files.
If some files are not being copied, they must not be matching either source path, or filename fileglob. Validate path and fileglob with Get-ChildItem
.
Solution 2:[2]
You can consider to store the source file list in a variable first Then validate by using foreach loop and if/else to verify are the files already copied, if not then write the message into error.log
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Jeter-work |
Solution 2 | Jimmy Soo |