Avatar of nvill3gas
Flag for United States of America

asked on 

RoboCopy behavior

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 ..

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.
Windows Server 2016* File Transfer* Robocopy

Avatar of undefined
Last Comment
Bill Prew

8/22/2022 - Mon