I have a process bat
at work to copy the modifications that I have made during the day in my personal folder to the server. I use XCOPY
the following way to do this:
@ECHO OFF
CLS
ECHO =============================================
ECHO Copia de ficheros a la carpeta de OneDrive
ECHO =============================================
@ECHO.
ECHO Si hay ficheros nuevos o modificados, se copiaran a continuacion... En caso de no haberlos, no se realizaran cambios
ECHO --------------------------------------------------------------------------------------------------------------------
XCOPY C:\Users\pablo.delgado.flores\Documents\Pablo_Delgado\* "C:\Users\pablo.delgado.flores\OneDrive - PDelgado" /E /D /C /Y
@ECHO.
ECHO Proceso terminado correctamente
PAUSE
Now I would like to improve it so that when I delete files in the local folder, I also delete them in the destination. I've been looking at parameters XCOPY
but haven't found any related to deletion. Looking at alternatives, I have come across ROBOCOPY
with /purge
like this:
ROBOCOPY C:\Users\pablo.delgado.flores\Documents\Pablo_Delgado\* "C:\Users\pablo.delgado.flores\OneDrive - PDelgado" /purge /V
But I can't do it. Is there a way?
It is not necessary to use the flag,
*
you can do it like this:which according to the same robocopy documentation
robocopy /?
( -MIR equivalent to /E plus /PURGE):example with /MIR: