Solved

Why does the attached code not find the folder?

Posted on 2011-03-15
10
439 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Are you looking to recover an email message or a contact you just deleted mistakenly? Or you are searching for a contact that you erased from your MS Outlook ‘Contacts’ folder and now realized that it was important.
Microservice architecture adoption brings many advantages, but can add intricacy. Selecting the right orchestration tool is most important for business specific needs.
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…

735 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