Batch Script which runs weekly?!?

Hi, i would like to write a batch script which is able to copy files from one shared folder to another folder every friday nite.  Is that possible for this loop thing to be done in batch script??  I also needs to exclude some files in the folder while copying.  Is this possible too?  please help~ thx

yours,
Vic
armansiuAsked:
Who is Participating?
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.

pauldohertyCommented:
I'm not sure what the loop is that you're referring to, but you can schedule the task to run every Friday night in one of two ways.  One is to use The Task Scheduler (Start/Programs/Accessories/System Tools/Scheduled Tasks), and the other is to use the command-line scheduler, 'at'.  For example to schedule your BAT file named foldercopy.bat to run Friday nights at 2 AM:

at 02:00 /every:F "c:\batfiles\foldercopy.bat"

As for copying the files you can use xcopy to do this.  And you can use the /EXCLUDE:file.txt parameter to give it a list of files (or wildcards for files) that you don't want to be copied.  You put the entries into file.txt and store it somewhere (perhaps even the same batfiles directory).  And in each line of the file specify a file you don't want copied.  Like this:

file.txt:

dontcopy1.exe
meneither.exe
leavemealone.txt
file.txt


I'm sure you get the idea.  Then your BAT file would simply look like this (assuming drive maps to shares have been established on letters Z: and Y:):

@echo off
z:
cd \dirtocopyfrom
xcopy /y *.* y:\dirtocopyto\*.* /EXCLUDE:z:\dirtocopyfrom\file.txt
0

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
brianadkinsCommented:

Just a little additional info about 'AT'...

these tasks will be separate from those in the "Scheduled Tasks" GUI.  However, the Resource Kit has another utility called JT.EXE that also manages tasks from the command line AND they show up in the Task Scheduler.

http://www.jsiinc.com/subf/tip2600/rh2621.htm
http://www.experts-exchange.com/Networking/WinNT_Networking/Q_20349387.html

-Brian
0
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
Microsoft DOS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.