Computer Help Forums

Computer Help Forum > IT Water Cooler > Newsgroup Archive > DIY Computers > Can somebody write me a batchfile...

Reply
Thread Tools Display Modes

Can somebody write me a batchfile...

 
 
Jon
Guest
Posts: n/a

 
      Jun 30th, 09, 10:53 PM
I need a batch file that says:

copy [path] to [path] expept if the file in each location is identical.

This is meant to be a rudimentary backup script that will run each time
the machine is shut down and will copy the contents of certain folders
to a separate hard disk, but I don't want to copy files that have not
been modified since last copy since there is about 1.5 Gb to copy.

I have looked at CmdSync but that requires a keypress so is not suitable
for automation.
--
Regards
Jon
 
Reply With Quote
 
 
 
 
GSV Three Minds in a Can
Guest
Posts: n/a

 
      Jun 30th, 09, 11:10 PM
Bitstring <>, from
the wonderful person Jon <> said
>I need a batch file that says:
>
>copy [path] to [path] expept if the file in each location is identical.
>
>This is meant to be a rudimentary backup script that will run each time
>the machine is shut down and will copy the contents of certain folders
>to a separate hard disk, but I don't want to copy files that have not
>been modified since last copy since there is about 1.5 Gb to copy.
>
>I have looked at CmdSync but that requires a keypress so is not suitable
>for automation.


What's wrong with synctoy (MS free download) which does exactly that
sort of thing, and can certainly be run as a batch command?

--
GSV Three Minds in a Can
15,016 Km walked. 2,773 Km PROWs surveyed. 50.1% complete.
 
Reply With Quote
 
Conor
Guest
Posts: n/a

 
      Jun 30th, 09, 11:14 PM
In article <>, Jon
says...
>
> I need a batch file that says:
>
> copy [path] to [path] expept if the file in each location is identical.
>
> This is meant to be a rudimentary backup script that will run each time
> the machine is shut down and will copy the contents of certain folders
> to a separate hard disk, but I don't want to copy files that have not
> been modified since last copy since there is about 1.5 Gb to copy.
>
> I have looked at CmdSync but that requires a keypress so is not suitable
> for automation.


Bloody kids.

XCOPY that's been around from DOS 3...

xcopy <source> <destination> /D:

/D: switch copies files changed on or after the specified date. If no
date is given, copies only those files whose source time is newer than
the destination time.

You could go one further if its possible to put all the different
folders you back up as subdirectories of one.

By addding the /S switch, it'll also copy all subdirectories as well.

So you want:

xcopy c:\backup d:\backup /D: /S

This would copy all files in the c:\backup and subdirectories which had
a file date/time newer than those in d:\backup and subdirectories. Omit
the /S switch if you don't want to go the subdirectory route.

--
Conor

I only please one person per day. Today is not your day. Tomorrow isn't
looking good either. - Scott Adams
 
Reply With Quote
 
Adrian C
Guest
Posts: n/a

 
      Jun 30th, 09, 11:27 PM
Jon wrote:
> I need a batch file that says:
>
> copy [path] to [path] expept if the file in each location is identical.
>
> This is meant to be a rudimentary backup script that will run each time
> the machine is shut down and will copy the contents of certain folders
> to a separate hard disk, but I don't want to copy files that have not
> been modified since last copy since there is about 1.5 Gb to copy.


Use Robocopy.exe from the resource kit for your windows OS.

I use the following to backup from "D:\FServer1\Documents\My
Music\iTunes\iTunes Music" to my "W:\" drive. It's incremental so it
doesn't try copying things that have already been written. Also remove
"/MIR" if you don't want to delete files in destination that have been
removed in source. It's fast!

rem /MIR means make the output directory just like the source directory,
including deleting files
rem /E copy subdirectories including empty ones - don't purge non matching
rem /XJ means exclude junction points
rem /R:1 means only retry failed copies once,
rem /ZB use restartable mode
rem /W:1 wait only 1 second between retries, I did this for the same
reasons as /R:1
rem /NP don't display progress copied

robocopy "D:\FServer1\Documents\My Music\iTunes\iTunes Music" W:\ /MIR
/E /XJ /R:1 /ZB /W:1 /NP /Log:"c:\ibacklog.txt"



--
Adrian C
 
Reply With Quote
 
Jon
Guest
Posts: n/a

 
      Jul 1st, 09, 1:03 AM
In article <>,
says...
> Bitstring <>, from
> the wonderful person Jon <> said
> >I need a batch file that says:
> >
> >copy [path] to [path] expept if the file in each location is identical.
> >
> >This is meant to be a rudimentary backup script that will run each time
> >the machine is shut down and will copy the contents of certain folders
> >to a separate hard disk, but I don't want to copy files that have not
> >been modified since last copy since there is about 1.5 Gb to copy.
> >
> >I have looked at CmdSync but that requires a keypress so is not suitable
> >for automation.

>
> What's wrong with synctoy (MS free download) which does exactly that
> sort of thing, and can certainly be run as a batch command?


Probably nothing, except I didn't know of it.
--
Regards
Jon
 
Reply With Quote
 
Jon
Guest
Posts: n/a

 
      Jul 1st, 09, 1:03 AM
In article <>,
says...
> In article <>, Jon
> says...
> >
> > I need a batch file that says:
> >
> > copy [path] to [path] expept if the file in each location is identical.
> >
> > This is meant to be a rudimentary backup script that will run each time
> > the machine is shut down and will copy the contents of certain folders
> > to a separate hard disk, but I don't want to copy files that have not
> > been modified since last copy since there is about 1.5 Gb to copy.
> >
> > I have looked at CmdSync but that requires a keypress so is not suitable
> > for automation.

>
> Bloody kids.
>
> XCOPY that's been around from DOS 3...
>
> xcopy <source> <destination> /D:
>
> /D: switch copies files changed on or after the specified date. If no
> date is given, copies only those files whose source time is newer than
> the destination time.
>
> You could go one further if its possible to put all the different
> folders you back up as subdirectories of one.
>
> By addding the /S switch, it'll also copy all subdirectories as well.
>
> So you want:
>
> xcopy c:\backup d:\backup /D: /S
>
> This would copy all files in the c:\backup and subdirectories which had
> a file date/time newer than those in d:\backup and subdirectories. Omit
> the /S switch if you don't want to go the subdirectory route.


That will do nicely, thank you.
--
Regards
Jon
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Slow write nobody760 DIY Computers 1 Feb 21st, 07 4:03 PM
Re: How long to write a video DVD? Gripper DIY Computers 1 Jun 8th, 06 5:32 PM
dvd-write/cd-rom not responding NickB Storage & Media 3 Jun 17th, 05 6:41 PM
ASP: Last doc write code help SwordWielder HTML & Coding 1 May 27th, 05 4:52 PM
Cannot write to drive c:/ Dharries3 Microsoft Windows 5 Dec 16th, 04 1:41 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36