Page 1 of 1
batch file for copying users profile data to a network drive
Posted: 12 Mar 2021 07:55
by loco
Hey Guys,
I am a novice to creating batch files and would be grateful for some assistance in getting one
which copies all the users profile data to a network drive (i) in this case.
I would also like there to be a some kind of progress bar indicating the status of the copying.
Really appreciate some help with this..
loco
Re: batch file for copying users profile data to a network drive
Posted: 12 Mar 2021 09:18
by Squashman
I would take a look at the Robocopy command.
Re: batch file for copying users profile data to a network drive
Posted: 12 Mar 2021 11:25
by loco
@Squashman , thanks man
I think I found something decent that should take care of it. But there's a bit more than just the below that I also need to add.
Let's say I also needed to add something which first performs a check on the size of all the files and if they are for example bigger than 5gig
then select a move to onedrive instead, any ideas on how I would go about it. Appreciate any help on this...
@ECHO OFF
SETLOCAL
SET DEST=\\servername\i$\Users\%USERNAME%
ROBOCOPY /MIR /XJ %USERPROFILE%\Documents %DEST%\Documents
ROBOCOPY /MIR /XJ %USERPROFILE%\Desktop %DEST%\Desktop
ROBOCOPY /MIR /XJ %USERPROFILE%\Favorites %DEST%\Favorites
ROBOCOPY /MIR /XJ %USERPROFILE%\Downloads %DEST%\Downloads
ROBOCOPY /MIR /XJ %USERPROFILE%\Appdata %DEST%\Appdata
KR
loco
Re: batch file for copying users profile data to a network drive
Posted: 12 Mar 2021 11:30
by Squashman
loco wrote: ↑12 Mar 2021 11:25
Let's say I also needed to add something which first performs a check on the size of all the files and if they are for example bigger than 5gig
then select a move to onedrive instead, any ideas on how I would go about it.
Did you miss reading this in the help file for Robocopy?
Code: Select all
/MAX:n :: MAXimum file size - exclude files bigger than n bytes.
/MIN:n :: MINimum file size - exclude files smaller than n bytes.
Re: batch file for copying users profile data to a network drive
Posted: 12 Mar 2021 11:35
by loco
I'll have another look and see if I can figure it out, thanks again.