Showing posts with label copy-item. Show all posts
Showing posts with label copy-item. Show all posts

Monday, January 19, 2009

copy items recursively

[] to copy the folder C:\temp\test1 to the new folder c:\temp\DeleteMe recursively

PS> Copy-Item C:\temp\test1 -Recurse c:\temp\DeleteMe

[] to copy all .txt files contained anywhere in c:\data to c:\temp\text

PS> Copy-Item -Filter *.txt -Path c:\data -Recurse -Destination c:\temp\text

be the force with you...

to overwrite a pre-existing destination, even when it is read-only

PS> Copy-Item -Path c:\boot.ini -Destination c:\boot.bak -Force

back-up an item

to back up C:\boot.ini to C:\boot.bak

PS> Copy-Item -Path c:\boot.ini -Destination c:\boot.bak

Sunday, January 18, 2009

copy content of a directory from and to

[] to copy the 'New.Directory' directory from the R: drive to the 'r:\temp' directory

PS> copy-item -path r:\new.directory -destination r:\temp

[] to copy all of the contents of a folder and overwrite the empty folder (if above is done)

PS> copy-item -path r:\new.directory -destination r:\temp -recurse -force -passthru