I'm looking for a powershell command that is equivalent to the following dos command:
for /f %%N in (test.txt) DO CALL robocopy "D:\User Areas\Reenrolled\%%N\My Documents" "\\SERVER\E$\Area\%%N\My Documents\sub folder" /E /R:0 > C:\diditwork.txt
I'm sure its something to do wiht assigning a variable somewhere but my mind has gone blank
Many thanks
PowershellScripting LanguagesWindows Server 2003
Last Comment
Colchester_Institute
8/22/2022 - Mon
Justin Owens
Are you wanting PowerShell to do the copying, or are you wanting PowerShell to call Robocopy?
Colchester_Institute
ASKER
Powershell to do the copying...Have a list of names in the text file that need to be used so for example the Text file might contain:
DrUltima
Joeblogs
MickyMouse
and i need those names to be used as the areas that are being copied is:
Server1\E:\Users\<Txt file name here eg Joeblogs>\My Docs
and its being copied to
Server2\E:\Users\<Txt file name here eg Joeblogs>\My Docs\Subfolder
Like i said i know i can do this using robocopy i'd just rather start using Powershell to do such things and am sure i'm just being dense...Its Friday arvo! LOL
That works perfect. ty..Just one more question incase i decide to add it or change it later.....How do i either make it move the original files or once its copied them delete the original files?
Many thanks
Colchester_Institute
ASKER
Also one thing i did notice.....Any subfolders weren't copied over...The files were but not the folders so the Files just ended up in one big folder for each user
The role of the sub folder is basically that i'm moving data from what was an old domain and placing it into the users area on the new domain. But what them to easily be albe to find the data from the old one :-) Many thanks