Copy and overwrite script

Hi, I'm looking for a script that will copy and overwrite jpeg files from one folder to another folder.

Thanks.
EncinitasAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Brian McDonaldIT ManagerCommented:
You'll probably have good luck with robocopy, I'd check that out and build one, should be one line and pretty simple.

https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy

Example based on what you are asking

robocopy C:\test1 C:\test2 /mir

This will mirror the files and folders in Test1 to Test2 (this removes everything from Test2 first, then copies from test1)
Bill PrewIT / Software Engineering ConsultantCommented:
We really need a little more to go by.  Is this just one folder of files?  Are there subfolders?  Etc.

It couple be as simple as a single command in a BAT file like:

copy /y "c:\dir1\*.jpg" "c:\dir2\*.jpg"

Open in new window


»bp
EncinitasAuthor Commented:
Looking for a script to copy all jpeg files \\server\folder\(all jpeg files) to -> \\server2\folder\(overwrite all jpeg files)  thx
EncinitasAuthor Commented:
Think I got it thanks - xcopy "C:\testxcopy" "\\server\IT\test" /Y
Bill PrewIT / Software Engineering ConsultantCommented:
Since you are only copying the files in a single folder, and reason you preferred xcopy over copy (for my own benifit)?

xcopy "C:\testxcopy" "\\server\IT\test" /Y
copy "C:\testxcopy" "\\server\IT\test" /Y



»bp

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.