InterviewSolution
Saved Bookmarks
| 1. |
Solve : How to echo the total files copied.? |
|
Answer» Hello All, Will the copied files be the only files in the destination folder?Yes, prior to copying to the directory, the batch deletes the destination directory to ensure they are the only files. ( I think I may know where your going with this, I like....) Quote from: gh0std0g74 on October 17, 2009, 09:36:29 AM if xcopy prints 732 files copied to the output, then you can definitely redirect that output to a file. use the > operator (or >>)Sorry, it's kinda early here, can you elaborate for my simple mind? Both: thanks for helpingQuote from: PPowerHouseK on October 17, 2009, 10:09:00 AM Yes, prior to copying to the directory, the batch deletes the destination directory to ensure they are the only files. ( I think I may know where your going with this, I like....)Well, if what you are saying is true, the batch deletes any previous files, then do this to count the amount of files: for /f "delims=" %%a in ('dir /B FOLDER') do set /a count+=1 echo Total files copied: %count% echo Total files copied: %count% > totalfiles.txt What Ghost is saying, is you can redirect the output of xcopy to the file, the same WAY I redirected the output of the second echo command to the file. Once again, thanks. Here is what I attempted to use: Code: [Select]for /f "delims=" %%a in ('dir /b C:\magic') do set /a count+=1 echo Total files copied: %count% echo Total files copied: %count% > BatchLog.txtMagic contains the 732 files, yet the result of running this is: Code: [Select]Total files copied: 1 I must have made a mistake somewhere...?Maybe add a \ after magic. Lol, that did it!!! I truly thank you all for helping me. Am I asking too MANY questions? I surely don't want to flood the forums, but I do research my question as much as possible before asking. Either way, thanks again. Quote from: PPowerHouseK on October 17, 2009, 10:55:53 AM Lol, that did it!!! I truly thank you all for helping me.Trust me, asking questions here will never be bad. If people stopped asking questions this forum would die. |
|