Hello Fred,
Interesting what your doing here. I guess your able to keep 10 levels of
backup with your Robobkup (zip) program. And the last one just gets bumped
off the end.
Nice.
As for the quotes needed around file/folder names containing empty spaces.
Yea, I stumbled over that for several days before trying the quotes. Drove
me crazy!
Using the xcopy.exe command, I use the /D switch which will only copy files
that don't exist in the destination location or who's time-stamp is newer
than the existing file on the destination drive.
Therefore, the first time I ran it may have taken 10-15 minutes to complete.
Now it only takes 5-10 seconds to complete running once per day.
Here is a copy-and-paste that will explain xcopy and it's switches.
==================================================
::Below information from Windows XP Help.
::Information Obtained via... (Open DOS Window, Then Type "help xcopy" )
::
::Microsoft Windows XP [Version 5.1.2600]
:
C) Copyright 1985-2001 Microsoft Corp.
::
::C:\Documents and Settings\Richard>help xcopy
::Copies files and directory trees.
::
::XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W]
:: [/C] [/I] [/Q] [/F] [/L] [/G] [/H] [/R] [/T]
[/U]
:: [/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z]
:: [/EXCLUDE:file1[+file2][+file3]...]
::
:: source Specifies the file(s) to copy.
:: destination Specifies the location and/or name of new files.
:: /A Copies only files with the archive attribute set,
:: doesn't change the attribute.
:: /M Copies only files with the archive attribute set,
:: turns off the archive attribute.
:: /D:m-d-y Copies files changed on or after the specified date.
:: If no date is given, copies only those files whose
:: source time is newer than the destination time.
:: /EXCLUDE:file1[+file2][+file3]...
:: Specifies a list of files containing strings. Each string
:: should be in a separate line in the files. When any of the
:: strings match any part of the absolute path of the file to
be
:: copied, that file will be excluded from being copied. For
:: example, specifying a string like \obj\ or .obj will
exclude
:: all files underneath the directory obj or all files with
the
:: .obj extension respectively.
:: /P Prompts you before creating each destination file.
:: /S Copies directories and subdirectories except empty ones.
:: /E Copies directories and subdirectories, including empty
ones.
:: Same as /S /E. May be used to modify /T.
:: /V Verifies each new file.
:: /W Prompts you to press a key before copying.
:: /C Continues copying even if errors occur.
:: /I If destination does not exist and copying more than one
file,
:: assumes that destination must be a directory.
:: /Q Does not display file names while copying.
:: /F Displays full source and destination file names while
copying.
:: /L Displays files that would be copied.
:: /G Allows the copying of encrypted files to destination that
does
:: not support encryption.
:: /H Copies hidden and system files also.
:: /R Overwrites read-only files.
:: /T Creates directory structure, but does not copy files. Does
not
:: include empty directories or subdirectories. /T /E includes
:: empty directories and subdirectories.
:: /U Copies only files that already exist in destination.
:: /K Copies attributes. Normal Xcopy will reset read-only
attributes.
:: /N Copies using the generated short names.
:: /O Copies file ownership and ACL information.
:: /X Copies file audit settings (implies /O).
:: /Y Suppresses prompting to confirm you want to overwrite an
:: existing destination file.
:: /-Y Causes prompting to confirm you want to overwrite an
:: existing destination file.
:: /Z Copies networked files in restartable mode.
::
::The switch /Y may be preset in the COPYCMD environment variable.
::This may be overridden with /-Y on the command line.
::
=====================================================
Using this "backup" approach does not zip, archive or compress the files in
any way. It just duplicates the files and existing folder structure to a
second drive location.
The /EXCLUDE switch works well too. But that can present another stumbling
block. If needed, let me know and I'll copy-and-paste an example of how I
use it.
(It's at home and I'm not there right now.)
Glad to be of help!
Best regards,
Richard in Va.
++++++++++++++++++++++++++++++++++++++++++++++++
Fred said:
Hello Richard,
Thanks for the replay. I waited until the execution of the two scheduled
batch files, 02:55 AM (runs in 20 seconds or less) and the second 03:00 AM
(11 minutes to complete) had run successfully.
The process that was used was the one suggested by starting with Control
Panel > Scheduled Task etc. and the batch file name was used as the
program
name. The batch file (quick on included) executed several commands and
then
initiated a program for completion.
The destination locations were checked to insure execution had taken place
and the files successfully completed.
My other concern was that the computer would be in a "sleep" mode in that
all of the power conservation settings would have kicked in more than an
hour
earlier. The three disk drives would be shut down too.
In your backup, I concluded you overwrite your file each time. I had
wanted
some depth to the backup so a scheme was implemented that provides about
10
copies, or backup over 10 days. Hopefully any problems could be
discovered
in that period.
The other issue that was a problem for a while, the blank space in file
names. Eventually I found out that quotation marks would solve the
problem.
After creating the batch file, another reference indicated that only the
file
name had to be in quotes. However, at that point, the older use of quotes
was working. If it ain't broke, don't fix it. I guess I'm just lazy.
In any case, the batch file has also been included for reference purposes.
Again, thank you very much for taking the time.
Fred
Echo Backup RoboForm File
echo Rev 20060404.0238
rem remove oldest file
del J:\backups\robobkup\roboback9.zip
rem shift all files up by 1
ren J:\backups\robobkup\roboback8.zip roboback9.zip
ren J:\backups\robobkup\roboback7.zip roboback8.zip
ren J:\backups\robobkup\roboback6.zip roboback7.zip
ren J:\backups\robobkup\roboback5.zip roboback6.zip
ren J:\backups\robobkup\roboback4.zip roboback5.zip
ren J:\backups\robobkup\roboback3.zip roboback4.zip
ren J:\backups\robobkup\roboback2.zip roboback3.zip
ren J:\backups\robobkup\roboback1.zip roboback2.zip
ren J:\backups\robobkup\roboback0.zip roboback1.zip
rem all files have been shifted. Begin backup
"c:\program files\pkware\pkzipc\pkzipc" -add -path=specify
J:/backups/robobkup/roboback0.zip "C:\Documents and Settings\MyName\My
Documents\My RoboForm Data\Default Profile\*"
echo RoboForm backup complete
Richard In Va. said:
Hello Fred,
I had the same question about a year ago.
Never found a (perfect) solution, however I did find an acceptable
workaround that works well for me.
From the top..... (For the benefit of others if needed)
Start>Settings>Control Panel>Scheduled Tasks.
Select "Add Scheduled Task" (This will open the "Scheduled Task Wizard")
Select the "Next" button.
In the Application List, Select the "Browse" button and browse to and
select
the DOS or
Windows command that you are using within the batch file.
(Maybe located in C:\WINDOWS\system32\ or somewhere similar)
Using this approach, you will not be using the batch file anymore. But
you
will be using the command line inside the batch file.
Select "Next" button.
Choose how often you want the task to run followed by the "Next" button.
(Can always change later if needed)
Choose the time of day for the task followed by the "Next" button.
The next window will ask for a password. Leave this blank and try not to
get excited about the warning.
This window will also display your computer name and your user login
name.
Leave this field as is.
Select the "Next" button.
Apply a check to the "Open Advanced Properties" check-box and select
"Finish".
Answer "Okay" to the warning that pops up in the next window.
The properties window for the new scheduled task should now be open. If
not, double-click on the new task from the scheduled task listing.
In the advanced properties window for your new task, select the "Task"
tab.
Apply a check to the "Run only if logged on" check-box.
Don't bother to add a password... you don't have one.
Here is where we get creative....
Note the command that is entered in the "Run:" field, should look like
this....
[Run:] C:\WINDOWS\system32\xcopy.exe
(I'm using the xcopy.exe command as an example)
Now open the batch file you created and have tested.
If your batch file contains only one command line your home free.
Copy-and-paste from the batch file the command and its parameters into
the
task schedule "Run:" field.
You will want them to look the same.
Mine looks like this...
" C:\Windows\System32\xcopy.exe "E:\*.*" "F:\Backup of Documents Drive E"
/E
/D /W /Y /I /R /K "
I'm using the xcopy.exe command to copy all (new or updated) files and
folders from partition drive (E) over to an external hard drive (F) every
day at 2:30PM as a scheduled task.
My drive (E) contains all my work related documents.
Cool Huh?
Now "apply" and close the task properties window and the task should run
according to the schedule (day/time) you selected.
If your batch file contained more than one (1) command line, You may need
to
create a scheduled task for each command. (really not sure about this
tho)
If what works well for me causes you problems. You might consider
putting a
shortcut to the batch file on your desktop. You'll need to remember to
double-click the shortcut to run the batch file tho. Also, you could put
the shortcut in your startup folder. Then it will run each time you
login,
pros-and-cons with this option as well I'm sure.
One last option is to create a script file to take the place of the batch
file. I think script routines co-exist much better with Windows (XP) and
task scheduler.
I don't know anything about scripts, maybe someone else can advise here.
Hope this is helpful!
Best regards,
Richard in Va.
+++++++++++++++++++++++++++++
I have a batch file I would like to schedule to run daily.
The attempt to use task scheduler and substitute the file.bat as the
program
did not work. I DO NOT have a password on my profile. There is an
administrator pw, but it is never needed. Now pw is ever needed.
I came across schtasks but did not know where to put it for
execution,
unless it goes in the "program name" area of schedule task. However,
since
schedule task will have all the scheduling information, I was confused.