Solved

Want to create a back up

Posted on 2006-11-05
16
163 Views
Last Modified: 2010-04-12
Hey is there away with the schudular task forme to set up a copy of a folder or drive to onther computer. if so how do I create the bath file to do this. and everynight in copyes it dose not append but it just writes over
0
Comment
Question by:eteran
  • 7
  • 7
  • 2
16 Comments
 
LVL 16

Expert Comment

by:glenn_1984
ID: 17877553
click on start
click on run
type notepad
and click ok

Lets assume you want to copy the data from c:\my documents\important\ to c:\backups on the same PC.
Your commands are:

xcopy "c:\my doucments\important\*.*" c:\backups\*.* /s /y /d

The /s = include all subfolders
/y = do not prompt to overwrite files
/d =only  copy files that are NEWER in the source folder.

Save the file to the desktop or anywhere you want with the extension .bat or .cmd  (i.e. backupimportant.bat)
Double click it to test.
Open Scheduled Tasks, browse for the filename and add it.

If you know how to share folders and map drives between PCs, to backup to another PC:

xcopy "c:\my doucments\important\*.*" k:\backups\*.* /s /y /d
k:= any drive letter of another pc
Instead of k: you could also share the backups folder on the other pc and use \\sharename\*.* etc.
0
 

Author Comment

by:eteran
ID: 17877917
OKay now /d =only  copy files that are NEWER in the source folder.
Does this mean that if something was modifiede it will also copy it to the back up folder??

0
 
LVL 16

Expert Comment

by:glenn_1984
ID: 17878250
Yes, it will copy.
Once a program is modified, the date is changed to the date it was modified.

So, if I create a file called thisfile on  November 1, 2006 and add data to it on November 3, 2006, the date of the file is now 11/03/2006
0
 
LVL 16

Expert Comment

by:glenn_1984
ID: 17878257
By all means, test your batch file after you create it.

The first time you run it, all files should copy.
If you then run it again, immediately after, nothing will copy.

If you want to verify the copy every day, add the following lines to the xcopy line above

@echo off
cls
dir targetdrive:\targetfolder\*.* /od   (order by date oldest first)
echo Please note time and date of files above.
pause

This will show you a list of the files copied, with the newest time and date files at the bottom of the list.
0
 

Author Comment

by:eteran
ID: 17878351
So step by step

1) open text file
2) paste xcopy "c:\my doucments\important\*.*" c:\backups\*.* /s /y /d
save it under .bat
and then doublke click it.

Is this it. I am new to this
0
 
LVL 16

Expert Comment

by:glenn_1984
ID: 17878380
You are correct.
Double click the icon on your desktop, that is...not the pasted text in Notepad.
0
 

Author Comment

by:eteran
ID: 17878410
What about echo off can you place in detail all the stuff it should have
I am new to these things
0
 
LVL 16

Accepted Solution

by:
glenn_1984 earned 500 total points
ID: 17878602
If you want to REVIEW the copy of files...use this:

xcopy "c:\my doucments\important\*.*" k:\backups\*.* /s /y /d
@echo off
cls
dir targetdrive:\targetfolder\*.* /od   (order by date oldest first)
echo Please note time and date of files above.
pause


If you just want the copy to run and close use this:

xcopy "c:\my doucments\important\*.*" k:\backups\*.* /s /y /d

Remember the line above is an example of syntax.  You must use YOUR source and target folders.
Try it out.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:eteran
ID: 17879008
getting an error system can not find file


F:\promas*.*" x:\backups\*.* /s /y /d
@echo off
cls
dir X:\backups\*.* /od   (order by date oldest first)
echo Please note time and date of files above.
pause
0
 

Author Comment

by:eteran
ID: 17879025
sorry this is the one I am running
F:\*.*" x:\*.* /s /y /d
@echo off
cls
dir x:\*.* /od   (order by date oldest first)
echo Please note time and date of files above.
pause
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 17880260
You have missed the xcopy command off first line...

xcopy F:\*.*" x:\*.* /s /y /d
@echo off
cls
dir x:\*.* /od   (order by date oldest first)
echo Please note time and date of files above.
pause
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 17880263
Don't give me points for that btw, was just passing!!
0
 

Author Comment

by:eteran
ID: 17882683
Still getting the same error. FIle not found. F:\ is a local drive on the server and x is a mapped drive. Can this effect anything
0
 
LVL 16

Assisted Solution

by:glenn_1984
glenn_1984 earned 500 total points
ID: 17883168
Remove the " from first command line.
You only need the " if you have multiple words in your folder name

Make sure you have space between f:\*.* and x:\*.*
0
 

Author Comment

by:eteran
ID: 17883852
Hey this is the final code, thanks for the help.

xcopy F:\*.* x:\*.* /s /y /d
@echo off
cls
dir x:\*.* /od   (order by date oldest first)
echo Please note time and date of files above.
pause
0
 
LVL 16

Expert Comment

by:glenn_1984
ID: 17883983
Remove the info below from your file

(order by date oldest first)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now