I am trying to create .bat file that syncs files and folders and so far I got up to this:
xcopy "C:\Users\user pc\Google Drive" "J:\Google drive offline backup" /d /e /f /h /i /j /k /r /s /y /z for %%F in ("J:\Google drive offline backup\*") do if not exist "C:\Users\user pc\Google Drive\%%~nxF" del "%%~fF"
This basically copies only the newly created or modified files or directories that are from the source directory into the destination directory. Then, it deletes the files from the destination directory that does not exist in the source directory.
Now the problem is that I also like to know how to delete sub-directories in the destination directory that does not exist in the source directory.
Please don't bash my codes if it is badly made I am just a rookie in command prompt..