Need help with folder and files copy in CMD
Posted: 22 Feb 2017 08:05
Hi,
I have setup a working batch script, which moves content of \\serverfolder\$username$ into the localcomputer $username$ OneDrive folder.
Sofar so good. but the problem is that i cant get the script to move files AND folders in the \\serverfolder\$username$
I cant find the code/syntax that moves not only files, but ALSO all folders with content. So i move the ENTIRE folder and all content. I tried using powershell, and also to use /ALL, /COPYALL, \*, \*.* etc parameters but i cant get it to Work.
I presume its the highlightend line (bold, underscore) where the code needs to be?
Can anyone help???
Thx:
------------------------------- my script ----------------------------------
@echo offrobocopy.exe "\\servername.domain.it-corp.net\homedirectory$\%username%" "C:\Users\%username%\OneDrive - EG A S\Gamle_H_Drev_Filer"
NET USE Z: \\servername.domain.it-corp.net\homedirectory$
NET USE W: \\servername.domain.it-corp.net\homedirectory$\Folders_synced_awaiting_OUmove_Then_Delete
MOVE Z:\%username% W:\
::Move c:\parentFolder\subFolder\*.* c:\parentFolder
NET USE Z: /delete
NET USE W: /delete
pause
I have setup a working batch script, which moves content of \\serverfolder\$username$ into the localcomputer $username$ OneDrive folder.
Sofar so good. but the problem is that i cant get the script to move files AND folders in the \\serverfolder\$username$
I cant find the code/syntax that moves not only files, but ALSO all folders with content. So i move the ENTIRE folder and all content. I tried using powershell, and also to use /ALL, /COPYALL, \*, \*.* etc parameters but i cant get it to Work.
I presume its the highlightend line (bold, underscore) where the code needs to be?
Can anyone help???
Thx:
------------------------------- my script ----------------------------------
@echo offrobocopy.exe "\\servername.domain.it-corp.net\homedirectory$\%username%" "C:\Users\%username%\OneDrive - EG A S\Gamle_H_Drev_Filer"
NET USE Z: \\servername.domain.it-corp.net\homedirectory$
NET USE W: \\servername.domain.it-corp.net\homedirectory$\Folders_synced_awaiting_OUmove_Then_Delete
MOVE Z:\%username% W:\
::Move c:\parentFolder\subFolder\*.* c:\parentFolder
NET USE Z: /delete
NET USE W: /delete
pause