Solved

Why does the attached code not find the folder?

Posted on 2011-03-15
10
434 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
 

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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now