Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

Scheduling a file copy of shared folder?


  • Please log in to reply

#1
APCSystems

APCSystems

    Member

  • Member
  • PipPip
  • 63 posts
I set up 2 PC's in a workgroup p2p environment. One of the PC's has a folder which is shared so the other PC can see it. Both people dump/change data in this shared folder on a regular day to day basis. My question is, Is there a way to regularly copy the contents of the shared folder onto the other PC's hard drive. That way if one PC craps out, the data is still on the other one? I know I can obviously do it manually, but I want to know if there is a way to set it up so it's automatic. Someone mentioned a .bat file or batch file, which I'm not really familiar with. This is for a small network I setup for someone who doesn't want to bother manually copying the folder contents on a regular basis. Any suggestions?
  • 0

Advertisements


#2
dsenette

dsenette

    Je suis Napoléon!

  • Administrator
  • 26,019 posts
  • MVP
you could create a batch file with the info below

copy <sourcefolderpathandname> \\<remotecomputername\<pathandfilename>

if any of those path's have spaces in the name (i.e. my documents) you have to put that section in quotes.....if you don't want it to ask you about overwrighting the file then put /Y at the end
  • 0

#3
dsenette

dsenette

    Je suis Napoléon!

  • Administrator
  • 26,019 posts
  • MVP
i take that back....sorry...copy is just for single files it looks like...let me dig a lttle deeper
  • 0

#4
dsenette

dsenette

    Je suis Napoléon!

  • Administrator
  • 26,019 posts
  • MVP
xcopy <source> \\<destination comp>\<destination location> /E /Y
should do it
  • 0

#5
APCSystems

APCSystems

    Member

  • Topic Starter
  • Member
  • PipPip
  • 63 posts

xcopy <source> \\<destination comp>\<destination location> /E /Y
should do it


How do you create a batch file. I've never done it before?
It would read:
xcopy<"shared folder">\\<computer1>\<"My Documents"> /E /Y
do i actually include the "<" and the ">", or was that just there for illustration purposes?
  • 0

#6
dsenette

dsenette

    Je suis Napoléon!

  • Administrator
  • 26,019 posts
  • MVP
the < and > are just for instructive purposes since i don't know what you're copying...but...to make a batch file...simply make a text file on your desktop or wherever...then insert the text below (of course after editing it to meet your needs (i'm gonna m ake something general here and explain what it's doing after) then change the file extension from .txt to .bat

xcopy c:\windows\winnt \\computer2\sharedfolder /E /Y

now what that would do if i ran it would copy the entire (that's what the /E is for) contents of the c:\windows\winnt folder (if it existed) to the Sharedfolder (would need to be an actuall shared folder not neccesarily named shared folder) on computer2 (if one existed) the /Y switch suppresses the prompt to overwrite the existing destination file
  • 0

#7
dsenette

dsenette

    Je suis Napoléon!

  • Administrator
  • 26,019 posts
  • MVP
if that is a task that you feel is too much you could also just post the full file path to the folder you want to copy (on the host computer) and the name and location that you want it coppied to on the other computer and i'll write it for you...
  • 0

#8
APCSystems

APCSystems

    Member

  • Topic Starter
  • Member
  • PipPip
  • 63 posts

if that is a task that you feel is too much you could also just post the full file path to the folder you want to copy (on the host computer) and the name and location that you want it coppied to on the other computer and i'll write it for you...


Thanks, but then I won't learn anything. Okay how's this:

xcopy C:\Documents and Settings\JSmith\"My Documents"\\dmh-ws-s486\C:\Documents and Settings\JASmith\Desktop\"New Folder" /E /Y

I saved it as batchfile.bat, I'm doing this just to test it. This should copy the contents of the My Documents folder to the "New Folder" folder that is on my desktop....right?

Edited by APCSystems, 23 March 2006 - 01:53 PM.

  • 0

#9
dsenette

dsenette

    Je suis Napoléon!

  • Administrator
  • 26,019 posts
  • MVP

xcopy C:\Documents and Settings\JSmith\"My Documents"\\dmh-ws-s486\C:\Documents and Settings\JASmith\Desktop\"New Folder" /E /Y

a few errors there...

xcopy "C:\Documents and Settings\JSmith\My Documents" "\\dmh-ws-s486\Documents and Settings\JASmith\Desktop\New Folder" /E /Y

if there's a space in a path..the WHOLE path must be in quotes...also there's a single space between the source info and the destination info

My Documents" <Space> "\\dmh-ws-

also...when going from one location to a remote location....the final destination MUST be a shared folder on the destination machine as \\destinationmachine\c: won't work...the \\destinationmachine\ basically is short for "shared location on destination machine\

so technically...if you create a folder named new folder on the desktop of the destination machine all you would need would be "\\destinationmachine\new folder" as the destination
  • 0

#10
APCSystems

APCSystems

    Member

  • Topic Starter
  • Member
  • PipPip
  • 63 posts

a few errors there...

xcopy "C:\Documents and Settings\JSmith\My Documents" "\\dmh-ws-s486\Documents and Settings\JASmith\Desktop\New Folder" /E /Y

if there's a space in a path..the WHOLE path must be in quotes...also there's a single space between the source info and the destination info

My Documents" <Space> "\\dmh-ws-

also...when going from one location to a remote location....the final destination MUST be a shared folder on the destination machine as \\destinationmachine\c: won't work...the \\destinationmachine\ basically is short for "shared location on destination machine\

so technically...if you create a folder named new folder on the desktop of the destination machine all you would need would be "\\destinationmachine\new folder" as the destination


hmmmm....i thought I did it right but it didn't work. i'm just messing with this on my own computer at work here. i'm copying within the same PC...the batch file appears to run, and I even did a print screen of it (which was hard to catch), but it doesn't copy the files to the New folder. Any ideas?
  • 0

#11
dsenette

dsenette

    Je suis Napoléon!

  • Administrator
  • 26,019 posts
  • MVP
ah...well the reason for that is you cant do the \\ part on the same machine if you're testing on a single machine then you'd want to test with

xcopy "C:\Documents and Settings\JSmith\My Documents" "C:\Documents and Settings\JASmith\Desktop\New Folder" /E /Y
pause

put that pause in there...that way the screen will stay open untill you press a key...that way you can see any errors if there are any
  • 0

#12
APCSystems

APCSystems

    Member

  • Topic Starter
  • Member
  • PipPip
  • 63 posts
That did it. Thanks for your help. That's pretty cool. Now how would I schedule that to happen daily at a certain time? Is that possible, or do batch files run when the PC boots up??
  • 0

#13
dsenette

dsenette

    Je suis Napoléon!

  • Administrator
  • 26,019 posts
  • MVP
well there are a few ways to schedule a task..but we'll go with the safest way....task scheduler...

now...i can never remember where microsoft hides the task scheduler soo...do start > help and support > and search for scheduled tasks

click on the blue scheduled tasks link on the right side and that should open scheduled tasks

double click add task and it will bring up the wizard..pretty straight forward from there
  • 0

#14
APCSystems

APCSystems

    Member

  • Topic Starter
  • Member
  • PipPip
  • 63 posts

well there are a few ways to schedule a task..but we'll go with the safest way....task scheduler...

now...i can never remember where microsoft hides the task scheduler soo...do start > help and support > and search for scheduled tasks

click on the blue scheduled tasks link on the right side and that should open scheduled tasks

double click add task and it will bring up the wizard..pretty straight forward from there


scheduled tasks....duh...i'm a bonehead. i thought it would only run programs, but i guess a batch file is a program. seems pretty straigh forward. thanks for the help. much appreciated.
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP