We'd like to remind Forumites to please avoid political debate on the Forum... Read More »
We're aware that some users are experiencing technical issues which the team are working to resolve. See the Community Noticeboard for more info. Thank you for your patience.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
Batch files
Options

rmg1
Posts: 3,159 Forumite


in Techie Stuff
Morning all
I've got a batch file which copies files to a separate folder on a hard drive for (dodgy) backup purposes.
Here's the code:-
f:
rem Kill off the Grandfather archive
f:
cd\
cd Grandfather_Backups
del symposiumbackup.bak
del CCCbackup.bak
del NOCReporting.bak
del NPFS.bak
del Sandpit.bak
del Staging.bak
del reference.bak
del reports.bak
del 111_Adastra_Local.bak
del 111_Adastra_Reference.bak
del 111_Adastra_Reporting.bak
del 111_Adastra_Staging.bak
rem Copy Father to Grandfather
f:
cd\
copy Father_Backups\symposiumbackup.bak Grandfather_Backups\symposiumbackup.bak
copy Father_Backups\CCCbackup.bak Grandfather_Backups\CCCbackup.bak
copy Father_Backups\NOCReporting.bak Grandfather_Backups\NOCReporting.bak
copy Father_Backups\NPFS.bak Grandfather_Backups\NPFS.bak
copy Father_Backups\Sandpit.bak Grandfather_Backups\Sandpit.bak
copy Father_Backups\Staging.bak Grandfather_Backups\Staging.bak
copy Father_Backups\reference.bak Grandfather_Backups\reference.bak
copy Father_Backups\reports.bak Grandfather_Backups\reports.bak
copy Father_Backups\111_Adastra_Local.bak Grandfather_Backups\111_Adastra_Local.bak
copy Father_Backups\111_Adastra_Reference.bak Grandfather_Backups\111_Adastra_Reference.bak
copy Father_Backups\111_Adastra_Reporting.bak Grandfather_Backups\111_Adastra_Reporting.bak
copy Father_Backups\111_Adastra_Staging.bak Grandfather_Backups\111_Adastra_Staging.bak
It doesn't seem to be working even though I've checked all the filenames are correct and the paths are correct.
The scheduled task which runs it gives a code 0x1 which appears to be something to do with a bad filename or command.
Anyone any ideas?
I've got a batch file which copies files to a separate folder on a hard drive for (dodgy) backup purposes.
Here's the code:-
f:
rem Kill off the Grandfather archive
f:
cd\
cd Grandfather_Backups
del symposiumbackup.bak
del CCCbackup.bak
del NOCReporting.bak
del NPFS.bak
del Sandpit.bak
del Staging.bak
del reference.bak
del reports.bak
del 111_Adastra_Local.bak
del 111_Adastra_Reference.bak
del 111_Adastra_Reporting.bak
del 111_Adastra_Staging.bak
rem Copy Father to Grandfather
f:
cd\
copy Father_Backups\symposiumbackup.bak Grandfather_Backups\symposiumbackup.bak
copy Father_Backups\CCCbackup.bak Grandfather_Backups\CCCbackup.bak
copy Father_Backups\NOCReporting.bak Grandfather_Backups\NOCReporting.bak
copy Father_Backups\NPFS.bak Grandfather_Backups\NPFS.bak
copy Father_Backups\Sandpit.bak Grandfather_Backups\Sandpit.bak
copy Father_Backups\Staging.bak Grandfather_Backups\Staging.bak
copy Father_Backups\reference.bak Grandfather_Backups\reference.bak
copy Father_Backups\reports.bak Grandfather_Backups\reports.bak
copy Father_Backups\111_Adastra_Local.bak Grandfather_Backups\111_Adastra_Local.bak
copy Father_Backups\111_Adastra_Reference.bak Grandfather_Backups\111_Adastra_Reference.bak
copy Father_Backups\111_Adastra_Reporting.bak Grandfather_Backups\111_Adastra_Reporting.bak
copy Father_Backups\111_Adastra_Staging.bak Grandfather_Backups\111_Adastra_Staging.bak
It doesn't seem to be working even though I've checked all the filenames are correct and the paths are correct.
The scheduled task which runs it gives a code 0x1 which appears to be something to do with a bad filename or command.
Anyone any ideas?
:wall: Flagellation, necrophilia and bestiality - Am I flogging a dead horse? :wall:
Any posts are my opinion and only that. Please read at your own risk.
Any posts are my opinion and only that. Please read at your own risk.
0
Comments
-
Nothing wrong with the syntax of the .bat
It's years since I did any scheduled tasks but 0x1 is an unknown function. Is the scheduled task calling on the right batch file or have you moved it or changed its name while you've been editing it?I'm dreaming of a white Christmas.
But, if the white runs out, I'll drink the red.0 -
I didn't think I had, but I'll double-check the path and filename.
Thanks for checking the syntax.:wall: Flagellation, necrophilia and bestiality - Am I flogging a dead horse? :wall:
Any posts are my opinion and only that. Please read at your own risk.0 -
The 0x1 status just notifies that the task encountered 'some' error. My OHs home folder backups nearly always end in 0x1 due to her not closing Outlook, leaving the mail folders in use by the system.
As WhiteChristmas says the syntax looks fine. Check the date stamps of the files in the Grandfather backups and see if they match. If you find one that doesn't have the most recent date on it then you should have a starting point of which file to look at. It's likely to be a file still in use, or a permissions issue.
You could also suffix >> x:\error.txt 2>&1 to your copy command lines so that the error outputs to an error log called 'x:\error'txt' (x being the letter of the drive you want the log to be created) which you can read back later for a better idea of the problem.0 -
I'm an idiot!
It does help if you remember not to try and copy files that don't exist any more. :wall::wall: Flagellation, necrophilia and bestiality - Am I flogging a dead horse? :wall:
Any posts are my opinion and only that. Please read at your own risk.0 -
Try running it in a Command Prompt window, and you will then see any error.
Or start the BATch file with something like
Grandfather.bat 1>GF.txt 2>&1
(much like Mista_C put on each copy command) you will get the entire console output in the GF.txt file. But you may have to press Enter one or more times to get the BATch file to finish, if it comes up with a question (which of course you cannot see).0 -
I'm an idiot!
It does help if you remember not to try and copy files that don't exist any more. :wall:
I wonder if we should be petitioning for the addition of a "Point and Laugh" button alongside "Thanks"? ;o)I'm dreaming of a white Christmas.
But, if the white runs out, I'll drink the red.0
This discussion has been closed.
Confirm your email address to Create Threads and Reply

Categories
- All Categories
- 350.8K Banking & Borrowing
- 253K Reduce Debt & Boost Income
- 453.5K Spending & Discounts
- 243.8K Work, Benefits & Business
- 598.6K Mortgages, Homes & Bills
- 176.8K Life & Family
- 257.1K Travel & Transport
- 1.5M Hobbies & Leisure
- 16.1K Discuss & Feedback
- 37.6K Read-Only Boards