Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Why does the attached code not find the folder?

Posted on 2011-03-15
10
Medium Priority
?
446 Views
Last Modified: 2012-05-11
I am trying to write a simple batch file to copy a folder on the C:\    drive
onto the F:\backup  drive.

When I run the attached code I get a message in the cmd prompt that the file can not be found.
I am 100% sure that this is the correct path.  What is wrong with my code?  Thanks
@echo off
:: variables
set drive=F:\backup
set backupcmd=xcopy /s /c /d /e /h /i /r /y

echo ### Backing up eDIGSNEW
%backupcmd% “C:\eDIGSNEW” "%drive%\eDIGS"



echo Backup Complete!
@pause

Open in new window

0
Comment
Question by:PDSWSS
  • 5
  • 3
  • 2
10 Comments
 
LVL 23

Expert Comment

by:OP_Zaharin
ID: 35143891
set drive=F:\backup
"%drive%\eDIGS"

based on the code above, i would like to double confirmed that you have F:\backup\eDIGS folder created?
0
 
LVL 3

Expert Comment

by:ssisworo
ID: 35143903
screen
if error like this, make sure the "C:\eDIGSNEW" already exists.
 screen
0
 
LVL 23

Expert Comment

by:OP_Zaharin
ID: 35143938
just double check that all the folder is there. and run the dos prompt as Administrator (right click on Command Prompt shortcuts and select Run As Administrator). kindly also confirmed you have access rights to F drive (if its a map drive).

@echo off
:: variables
set backupcmd=xcopy /s /c /d /e /h /i /r /y

echo ### Backing up eDIGSNEW
%backupcmd% “C:\eDIGSNEW” "F:\backup\eDIGS"

echo Backup Complete!
@pause
0
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 

Author Comment

by:PDSWSS
ID: 35143964
I am running as an administrator Remote Desktop from a  cmd file and I get the error posted by ssisworo for both my code and your code as if the folder  "eDIGSNEW"  does not exist.  
0
 

Author Comment

by:PDSWSS
ID: 35143982
I also get a strange character in the cmd window after the file name. Please see attached.
Could this be due to a corrupted file?
Picture-9.png
0
 
LVL 23

Expert Comment

by:OP_Zaharin
ID: 35144032
if u do a copy paste of my codes, kindly delete the doublequotes (") on the %backupcmd% "C:\eDIGSNEW" "F:\backup\eDIGS" lines and re-keyin the doublequotes manually...
0
 
LVL 3

Expert Comment

by:ssisworo
ID: 35144046
1. make sure “C:\eDIGSNEW” flanked by quotation marks
2. try using another name. for example "C:\TEST"
0
 
LVL 23

Accepted Solution

by:
OP_Zaharin earned 2000 total points
ID: 35144055
you can see the odd/different doublequotes for both c:\eDGISNEW and f:\backup\eDIGS in your codes “C:\eDIGSNEW” "%drive%\eDIGS"

so delete the doublequotes and manually type it in notepad/edit command in dos prompt. do not use wordpad/ms words.
0
 

Author Closing Comment

by:PDSWSS
ID: 35144278
Thanks for ending my headache.
0
 
LVL 23

Expert Comment

by:OP_Zaharin
ID: 35144343
glad i'm able to help :)
0

Featured Post

[Webinar] Cloud Security

In this webinar you will learn:

-Why existing firewall and DMZ architectures are not suited for securing cloud applications
-How to make your enterprise “Cloud Ready”, and fix your aging DMZ architecture
-How to transform your enterprise and become a Cloud Enabler

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Create your own, high-performance VM backup appliance by installing NAKIVO Backup & Replication directly onto a Synology NAS!
Windows Server 2003 introduced persistent Volume Shadow Copies and made 2003 a must-do upgrade.  Since then, it's been a must-implement feature for all servers doing any kind of file sharing.
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
This tutorial will walk an individual through the process of installing of Data Protection Manager on a server running Windows Server 2012 R2, including the prerequisites. Microsoft .Net 3.5 is required. To install this feature, go to Server Manager…
Suggested Courses

971 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