error in sh script while copy files to a backup directory

I am trying to copy files from one directory to another using shell script. Can anyone please troubleshoot the code.

thanks in advance...

 
#!C:\Shell\sh.exe
files_dir="C:\Documents and Settings\scripts\files"
backup_dir="C:\Documents and Settings\scripts\ztest"
 
echo cding to files directory
cd $files_dir
 
echo copying all files to backup directory
copy $files_dir $backup_dir
 
 
 
Output:
 
C:\Documents and Settings\scripts>sh backup.sh
cding to files directory
cd: can't cd to C:\Documents
copying all files to backup directory
copy: not found
 

I see you're using Windows, which might make things quite different than a usual Linux or UNIX shell script, but for starters, try:

cd "${files_dir}"

Since the directory had spaces it was splitting it into parts, quotes stop that.

I believe COPY is built into windows cmd.exe now, you may need to install cp to get a commandline utility for that which works in your shell.

As Corona688's suggestion, you need quote all the vars.

cd "$files_dir"

copy "$files_dir" "$backup_dir"