How to copy sub dirs using batch file
Posted on 2005-05-10
Hi I'm new to batch files and I have this:
rem This is a template of a batch file that will backup to another drive :)
rem move to the D: drive of the machine
rem move to the backup directory off the root
rem THIS SHOULD BE MOVED TO ANOTHER DIR AND DELETED ONLY AFTER BACKING UP
re delete all files in this dir
rem delete all sub dirs in the dir
rem create the new dirs
mkdir "my z documents"
mkdir "d:\backup\my z documents\my pictures"
mkdir "d:\backup\my z documents\my webs"
rem copy the files into the backup directory
copy "Z:\My Documents\*.*" "d:\backup\my documents"
rem I WANT TO BACKUP ENTIRE DIRS and SUB DIRS WITHOUT HAVING TO NAME THEM ALL
copy "C:\Documents and Settings\myname\Application Data\Mozilla\thunderbird\*.*" "d:\backup\mozilla"
rem quit the program as we are finished the tack
:) so where I have caps I need guidance.
1. I want to COPY and not DELETE the 'old' backup into a sub dir in case something goes wrong
2. When performing the actual back up, I don't want to have to name every dir.
Know what I mean? should be simple but I'm a total newbie :) thanks.