We help IT Professionals succeed at work.
Get Started

RoboCopy behavior

101 Views
Last Modified: 2018-11-09
Hello All,

I am struggling with what i thought would be a simple RoboCopy script. However, I am getting some very odd behavior I have never encountered  before and I am at my wits end.  

A bit about the environment the to locations are 2 server 2016 vms and are on the same subnet. Source server is a production file server and destination server test bed for program that a department is considering using. The source location contains sub folders and images mostly with about 55gb of used space. The script is triggered via a scheduled task.

@echo Off
set DirDate=%date:~-10,2%.%date:~-7,2%.%date:~-4,4%
set Name1=IMG_DB_Sync_"%DirDate%"
set Name3=IMG_DB_RoboCopy"%DirDate%"
echo ====%time% - Parameters have been set==== >>\\Source_Server\it_share$\Script_REPO\IMG_DB_Sync\LOGS\%Name1%.log
;
echo ====%time% - RoboCopy Starting for Image DataBase Sync==== >>\\Source_Server\it_share$\Script_REPO\IMG_DB_Sync\LOGS\%Name1%.log
@echo Off
Robocopy /mir /S /j /R:5 /W:15 /MT:8 "\\Source_Serverr\SharedFolder$\!IMAGE DATABASE" "‪\\Dest_Server\SharedFolder$\!IMAGE DATABASE" /xf ".DS_Store" /LOG:\\Source_Server\it_share$\Script_REPO\IMG_DB_Sync\LOGS\%Name3%.log /v /ts /fp
echo ====%time% - RoboCopy for IMG_DB Sync Finished==== >>\\Source_Server\it_share$\Script_REPO\IMG_DB_Sync\LOGS\%Name1%.log
;
@echo Off
echo ====%time% - Sending IMG_DB_Sync_RoboCopy log==== >>\\Source_Server\it_share$\Script_REPO\IMG_DB_Sync\LOGS\%Name1%.log
echo ..
powershell.exe -command "& {Send-MailMessage -SmtpServer 'smtp.server.com' -From 'foldersync@domain.com' -To 'IT@domain.com' -Subject 'File Sync' -Body 'Please see attached log for details' -Attachments '\\Source_Server\it_share$\Script_REPO\IMG_DB_Sync\LOGS\%Name3%.log'}"
echo ====%time% - Sent IMG_DB_RoboCopy log file==== >>\\Source_Server\it_share$\Script_REPO\IMG_DB_Sync\LOGS\%Name1%.log
;
@echo Off
echo ====%time% - Log Cleanup Starting. ==== >>\\Source_Server\it_share$\Script_REPO\IMG_DB_Sync\LOGS\%Name1%.log
ForFiles /p "\\Source_Server\it_share$\Script_REPO\IMG_DB_Sync\LOGS" /s /d -30 /c "cmd /c del @file & echo @path" >>\\Source_Server\it_share$\Script_REPO\IMG_DB_Sync\LOGS\%Name1%.log
echo: >>\\Source_Server\it_share$\Script_REPO\IMG_DB_Sync\LOGS\%Name1%.log
echo ====%time% - Log Cleanup Completed. ==== >>\\Source_Server\it_share$\Script_REPO\IMG_DB_Sync\LOGS\%Name1%.log
echo ..
;
@echo Off
echo ====%time% - Image DataBase has been synced==== >>\\Source_Server\it_share$\Script_REPO\IMG_DB_Sync\LOGS\%Name1%.log
echo ..
;
End

Open in new window


Now to the meat of my issue. No matter how i run this script or if i just run the robocopy command direct from a cmd window I encounter this issue. When the robocopy job is running it appears to be creating a directory in "C:\Windows\System32\‪" with folder structure of the destination portion of the the command followed by the folder and file structure of the data we are trying to copy. So it reads "C:\Windows\System32\‪\Dest_Server\SharedFolder$\!IMAGE DATABASE"

The issue come into play is when this is happening it is filling the c drive as it is only a 40gb drive for just the OS. Instead of increasing the drive size I would like to see if there a reason\solution for this behavior.

Thanks in advanced for looking at this.
Comment
Watch Question
Test your restores, not your backups...
CERTIFIED EXPERT
Expert of the Year 2019
Distinguished Expert 2020
Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE