Yes, read comments in the code and read comments after the post and double check the information against multiple sources & blogs.
and there's a flip side for posters: make your examples as complete and bullet-proof as possible. If I were posting this code, I would have done the following:
- parameterize the source & destination paths
- embedded an xp_cmdshell statement to copy the files over in the script
- look for multiple database file devices.
--- flag if they span multiple drives, perhaps for load balancing, etc.
--- There is no guarantee that a DB will have only one data & one log device, or that the names will follow a standard.