Link to home
Create AccountLog in
Microsoft DOS

Microsoft DOS

--

Questions

--

Followers

Top Experts

Avatar of Dave Stone
Dave Stone🇺🇸

Backup a Local Directory to the Network Using a BAT File
Hello,
      I am trying, (like heck), to create a bat file to backup some files. The files are located at C:\Users\Public\Public Documents\zeiss\calypso\workarea\inspections. The “inspections” directory has many floders and subfolders and I want them all to backup to the specified directory when I run this bat file. I have tried everything I could think of but I either get an invalid path error, or a cannot find file error, etc. What do I need to do to get this?
Here is my current bat file syntax:
xcopy "C:\Users\Public\Public Documents\zeiss\calypso\workarea\inspections" /s /c /d /e /h /i /r /y \\dc1\data\BEPAC_CMM\Zeiss_1\  

Thank you

Zero AI Policy

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


Avatar of oBdAoBdA

Don't use xcopy; it's utterly outdated. robocopy is part of the OS since Vista. Best of all: it doesn't have problems with long paths.
robocopy.exe "C:\Users\Public\Public Documents\zeiss\calypso\workarea\inspections" "\\dc1\data\BEPAC_CMM\Zeiss_1" *.* /e /r:0 /np /tee /log:"C:\Temp\robocopy.log"

Open in new window


Avatar of Dave StoneDave Stone🇺🇸

ASKER

Thanks. I tried this locally first with a different folder. I used this:

robocopy.exe "C:\Users\Public\Public Documents\my conceptdraw" "d:\test *.* /e /r:0 /np /tee /"

I attached my results
PrintScreen.pdf

The error message is pretty clear: the target folder is incorrect, because the closing quotes include command line options.
If you don't need the log file, you can drop the /tee and /np as well:
robocopy.exe "C:\Users\Public\Public Documents\my conceptdraw" "d:\test" *.* /e /r:0"

Open in new window


Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


Avatar of Dave StoneDave Stone🇺🇸

ASKER

robocopy.exe "C:\Users\Public\Public Documents\My ConceptDraw" "d:\test" *.* /e /r:0

I have attached the results
2PrintScreen.pdf

Avatar of Dave StoneDave Stone🇺🇸

ASKER

This driving me crazy!

Avatar of Dave StoneDave Stone🇺🇸

ASKER

The directory is there. I attached a screen print for both.
path.pdf
path2.pdf

Free T-shirt

Get a FREE t-shirt when you ask your first question.

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


That's Explorer and its manipulated address bar for you.
In Explorer, browse to the folder you want to use as source. Now click in the empty part of the address bar, to the right of the end of the address (not on the breadcrumbs); the display should now switch to a single highlighted string (probably to "C:\Users\Public\Documents\My ConceptDraw"). Hit Ctrl-C while the string is still highlighted, and paste it into the script.

Avatar of Dave StoneDave Stone🇺🇸

ASKER

Perfect! Thanks a million. Just one more thing. The xcopy bat I was using was only copying new or modified files. Is this robocopy doing the same?

ASKER CERTIFIED SOLUTION
Avatar of oBdAoBdA

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account

Avatar of Dave StoneDave Stone🇺🇸

ASKER

Thanks again.

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.

Microsoft DOS

Microsoft DOS

--

Questions

--

Followers

Top Experts

Microsoft Disk Operating System (MS-DOS) was an operating system for x86-based personal computers, and traces of it are still found in the Windows operating system. DOS is still used in some embedded systems and for certain legacy 16-bit networks.