Solved

Why doesn't this Scheduled backup task work?

Posted on 2004-09-09
7
170 Views
Last Modified: 2010-04-14
If i enter the following into COPY.CMD and then register this CMD into
the Schedule Task list I see it run & it exits immediately with error code 4.
Can anyone explain why?

File COPY.CMD
==========
echo "Delete target directories"
del /F /S /Q w:\*.*
echo "Copy Over"
xcopy f:\foo w:\foo /s /Y
xcopy f:\goo w:\goo /s /Y
xcopy f:\hoo w:\hoo /s /Y


The above was run under the Administrator account, F is the local machine, W is
a drive mounted on a separate machine on a local network.

Is it having a problem with the *.* list, there are quite a few files involved.
0
Comment
Question by:nicksbell
  • 4
  • 2
7 Comments
 
LVL 17

Expert Comment

by:Eagle6990
ID: 12021977
What happens if you manually run the file from a command line? You might be able to see more of what is going on.
Are you trying to delete just the file or the directories as well? If you want to delete the directories then you need to use the rd command.
0
 
LVL 2

Author Comment

by:nicksbell
ID: 12022642
Sorry, i should have mentioned that, i can run the CMD file just fine on its own, it is only
when run from the scheduler that it has the problem
0
 
LVL 17

Expert Comment

by:Eagle6990
ID: 12022733
I would start rem'ing everything out, or maybe rem out everything and see if it can run then. if it can't, then you know it is an issue with your schedule.  Gradually work it back until you find out exactly which line is causing your error.
0
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
LVL 16

Expert Comment

by:glenn_1984
ID: 12023240
The Task Scheduler needs a user name AND password to work.
You may add it to the Task Properties.

Then right click on the task and Run to test
0
 
LVL 2

Author Comment

by:nicksbell
ID: 12025989

So, i investigated this some more. It seems to be related to the W drive. If i try and use the
same sort of CMD file to just delete (no xcopy) a file on the local C drive it works.

But if i try and delete the same file when it is on the shared W drive it fails!
0
 
LVL 17

Accepted Solution

by:
Eagle6990 earned 75 total points
ID: 12026857
Sounds like a permissions issue.  Don't know for sure, but one thing you could try is to dismount the W: drive in your batch file and then remount it before attempting to delete so it is created with the same permissions the batch file has.  Try the "net use" command to remove and add a mapped drive.
0
 
LVL 17

Expert Comment

by:Eagle6990
ID: 12028534
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

679 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