Dos Cmd help plz

Soldato
Joined
9 Aug 2004
Posts
7,795
Location
Milton Keynes
Need to write some commands in a bat files (is that the correct term?) which will be run every night a 2am (via scheduled tasks) to back up files from my docs and some other folders.

Docs Folder : C:\Documents and Settings\Blackwell\My Documents

Other Folder : H:\

Backup drive : F:\

Now the questions

a) How do i put spaces into a dos command?

b) Is Xcopy the correct command

c) Which switches would i use so it only copies over files that have been changed since last back up

d) Can i also copy my website files aswell?

My Guess to start off;

XCOPY C:\Documents%and%Settings\Blackwell\My%Documents\*.* F:\Docs /E /U

No idea about the website one though
 
put the path in quotes to use spaces. eg

xcopy "c:\documents and settings\path to folder"

as for the rest, check out the help and support center on the start menu. search for "xcopy".... :p

as for your website, i'm guessing you'd need a command line ftp client? sorry for the vagueness.... :D
 
close but it will need to look more like this

Code:
@echo off
xcopy "C:\Documents and Settings\Blackwell\My Documents\*.*" F:\Docs /V /Y /E

The @Echo off will hide all of the commands being run

and putting ""around the directory will include the spaces

/V Verifies files after being writen
/Y Confirms over write
/E Copies sub directorys

I dont understand why you are using the /U option as it old copies files that already exis in the destination folder. If you use this any files you have added since last backup would not be copied.

What do you mean about copying the website? if you mean uploading there is a comand line ftp program that will upload from the command prompt. But you need to explain more to be able to tell you what you need to do. Also if you mean downloading and copying to a safe location this is also possible.
 
Last edited:
Sorry for being ot, but I jumped straight into using robocopy for my backup after searching this forum.
Whats the difference/benefits of xcopy v robocopy?
 
XCOPY has been around for years and works well. :)

I have used it loads and there are so many variables and switches for it. Want to exclude some files from being back up? Add a /Exclusions: blah.txt on the end of the command and put the files / folders names in blah.txt
 
FishThrower said:
why dont you use Windows backup?

Because i cant find it in xp?

BigBoy said:
What do you mean about copying the website? if you mean uploading there is a comand line ftp program that will upload from the command prompt. But you need to explain more to be able to tell you what you need to do. Also if you mean downloading and copying to a safe location this is also possible.

Well erm, I want to copy files off my website, from the net to my pc, they are in the http part not the ftp bit if that helps
 
Well erm, I want to copy files off my website, from the net to my pc, they are in the http part not the ftp bit if that helps

you will need a web grabber or need to ftp in and pull it down that way.
 
ste_bla said:
Because i cant find it in xp?



Well erm, I want to copy files off my website, from the net to my pc, they are in the http part not the ftp bit if that helps


huh?

Windows backup is in Start - Accessoires - System Tools

Seems a bit pointless if you want to do a .bat file for just simply backing up something
 
BigBoy said:
you will need a web grabber or need to ftp in and pull it down that way.


You can create a network drive to a letter, and do it that way afaik

EDIT: Also if you are going to do backup through a .bat file, you have to make it so it overwrites exisiting files, not too sure what the switch is for xcopy to do that
 
FishThrower said:
huh?

Windows backup is in Start - Accessoires - System Tools

Seems a bit pointless if you want to do a .bat file for just simply backing up something

where.JPG


Where?
 
didnt know that anyone used XP Home :p


i think you can copy over the .EXE for winbackup from Pro and run it in Home if you find someone with XP Pro installed

%SystemRoot%\system32\ntbackup.exe
 
FishThrower said:
didnt know that anyone used XP Home :p


i think you can copy over the .EXE for winbackup from Pro and run it in Home if you find someone with XP Pro installed

%SystemRoot%\system32\ntbackup.exe

From a google seems i can get it off my xp cd

cheers i'll give that a go
 
You probably need to install it via Add/Remove Programs in the control panel.

edit: opps, didn't realise it was XP Home
 
ste_bla said:
From a google seems i can get it off my xp cd

cheers i'll give that a go


its a lot easier that way, when it backs up, it puts it all in one file, to restore it from backup, double click on the file, and then choose what files you want restoring. Sounds a bit like a pain but its easier to orgainise and a lot more reaible than using a batch script.

If you want to backup files from a web server (FTP or HTTP) you can create a virtual drive and link it to that. You can do that in My Network Places

Once you created the icon in network places, you should then be able to map it using a drive letter, then let Windows Backup, backup that drive as well

Bare in mind though, depending on the site, I would imagine it will take a while to download everything from the FTP server, so it may take 10-15 mins to actually do.
 
Back
Top Bottom