Backup your tasks

Discuss RoboTask here
Oleg
Site Admin
Posts: 3088
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Backup your tasks

Post by Oleg »

I added one step to the task (see step #15)
Try this. It allows to find problem folder.

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|0
CatID=INTEGER|1163085779
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
Events=FOLDER
ExternalName=STRING|"Task17"
Hide=INTEGER|0
ID=INTEGER|913310745
LogOnAsUser=INTEGER|1
Name=STRING|"[DEMO] Backup your tasks (daily backup) (imported)"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action10=FOLDER
Action11=FOLDER
Action12=FOLDER
Action13=FOLDER
Action14=FOLDER
Action15=FOLDER
Action16=FOLDER
Action17=FOLDER
Action18=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""BACKUPFOLDER"" with value ""c:\auto\RoboTaskBackup"""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"1"
varkind=STRING|"1"
varname=STRING|"BACKUPFOLDER"
varvalue=STRING|"c:\auto\RoboTaskBackup"

[Actions\Action10]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""OLDFOLDER"" with value """""
Params=FOLDER

[Actions\Action10\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"OLDFOLDER"

[Actions\Action11]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""CNT"" with value ""0"""
Params=FOLDER

[Actions\Action11\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"CNT"
varvalue=STRING|"0"

[Actions\Action12]
ActionID=STRING|"A_LOOP_FILE"
Enabled=INTEGER|-1
Name=STRING|"File Loop"
Params=FOLDER

[Actions\Action12\Params]
createmode=STRING|"1"
date1=STRING|"20130328"
date2=STRING|"20130328"
destvar=STRING|"OLDFOLDER"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"{BackupFolder}\*.*"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"1"
sort=STRING|"1"
sortby=STRING|"0"
sortorder=STRING|"1"
subdirs=STRING|"1"
timesize=STRING|"0"
WithoutPath=STRING|"0"

[Actions\Action13]
ActionID=STRING|"A_VARIABLES_INCREMENT"
Enabled=INTEGER|-1
Name=STRING|"Increment variable ""cnt"""
Params=FOLDER

[Actions\Action13\Params]
incement=STRING|"1"
vaiable=STRING|"cnt"

[Actions\Action14]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER

[Actions\Action14\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"3"
type=STRING|"1"
value1=STRING|"{Cnt}"
value2=STRING|"{BackupDays}"

[Actions\Action15]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER

[Actions\Action15\Params]
message=STRING|"Removing {oldFolder}"
type=STRING|"3"

[Actions\Action16]
ActionID=STRING|"A_FOLDER_REMOVE"
Enabled=INTEGER|-1
Name=STRING|"Remove Nonempty Folder  ({OldFolder})"
Params=FOLDER

[Actions\Action16\Params]
deletefolder=STRING|"1"
folder=STRING|"{OldFolder}"

[Actions\Action17]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"

[Actions\Action18]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""TODAYFOLDER"" with value ""{BackupFolder}\{Year}{MonthNo}{Day}"""
Params=FOLDER

[Actions\Action2\Params]
expand=STRING|"1"
varkind=STRING|"1"
varname=STRING|"TODAYFOLDER"
varvalue=STRING|"{BackupFolder}\{Year}{MonthNo}{Day}"

[Actions\Action3]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""BACKUPDAYS"" with value ""7"""
Params=FOLDER

[Actions\Action3\Params]
expand=STRING|"1"
varkind=STRING|"1"
varname=STRING|"BACKUPDAYS"
varvalue=STRING|"7"

[Actions\Action4]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER

[Actions\Action4\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"1"
type=STRING|"3"
value1=STRING|"{FileExists({TaskFolder}\*.tsk)}"

[Actions\Action5]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER

[Actions\Action5\Params]
message=STRING|"Wrong task folder. Reconfigure the task, please"
type=STRING|"2"

[Actions\Action6]
ActionID=STRING|"A_LOOP_BREAK"
Enabled=INTEGER|-1
Name=STRING|"Break"

[Actions\Action7]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"

[Actions\Action8]
ActionID=STRING|"A_FOLDER_SYNCHRONIZE"
Enabled=INTEGER|-1
Name=STRING|"Synchronize Folders"
Params=FOLDER

[Actions\Action8\Params]
clearro=STRING|"0"
details=STRING|"0"
detailstovar=STRING|"0"
exact=STRING|"0"
foder1=STRING|"{TaskFolder}"
foder2=STRING|"{TodayFolder}"
hidden=STRING|"0"
howsync=STRING|"1"
includeempty=STRING|"0"
includemask=STRING|"*.*"
subdir=STRING|"0"
system=STRING|"0"
twosecprecision=STRING|"1"

[Actions\Action9]
ActionID=STRING|"A_MISC_COMMENT"
Enabled=INTEGER|-1
Name=STRING|"//Now remove old backup folders"
Params=FOLDER

[Actions\Action9\Params]
comment=STRING|"Now remove old backup folders"

[Events]
Event1=FOLDER

[Events\Event1]
Enabled=INTEGER|-1
EventID=STRING|"E_FILE_MONITOR"
Name=STRING|"File Monitor"
Params=FOLDER
UniqueID=INTEGER|45692128

[Events\Event1\Params]
chg=STRING|"1"
chga=STRING|"1"
chgsl=STRING|"1"
chgsm=STRING|"1"
chgtl=STRING|"1"
chgtm=STRING|"1"
del=STRING|"0"
folder1=STRING|"{TaskFolder}"
foldercount=STRING|"1"
incmask=STRING|"*.*"
interval=STRING|"60"
listmode=STRING|"1"
mon_files=STRING|"1"
mon_folders=STRING|"0"
new=STRING|"1"
pass=STRING|"0"
passmode=STRING|"1"
saveresults=STRING|"0"
subfolders1=STRING|"0"


Oleg Yershov
Oleg
Site Admin
Posts: 3088
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Backup your tasks

Post by Oleg »

Yes, mine too. But on the seventh day it starts failing when removing the folder.
Yes!! I reproduced your problem and get the same error message

-: 02.05.2022 20:11:40: Executing "15.Log Message"
-: 02.05.2022 20:11:40: Removing c:\auto\RoboTaskBackup\20220430
-: 02.05.2022 20:11:40: Executing "16.Remove Nonempty Folder ({OldFolder})"

-: 02.05.2022 20:11:40: File access denied
-: 02.05.2022 20:11:40: Failed execute 'ExecAction with exception: File access denied' (C:\Program Files\RoboTask\Plugins\Files\FileMan.rtp)
-: 02.05.2022 20:11:40: An error occurred. Reconfigure this step.
-: 02.05.2022 20:11:40: Task execution is aborted


The problem is in permissions of backup folder.
Check the folder 20220425. It seems the folder is empty BUT you can not delete it. because you have not enough permissions to remove it.
Also check permissions on backup folder and on all nested files and folders
Oleg Yershov
cagigas
Posts: 10
Joined: Mon Apr 18, 2022 10:57 am

Re: Backup your tasks

Post by cagigas »

I tried your last version's task with the log message that allows to see the problematic folder.
The problematic folder is the number 8, sorted by name in descending order, the one that should be deleted today to end with 7 folders only. All as expected.

I changed permissions to allow "total control" on that folder, also on root folder C:\TaskBackup (I'm now testing the task in this folder).

When I check the permissions that I just changed I can see they are automtically set back to initial state ("read only").

Maybe my windows 10 or my antivirus kaspersky is blocking me to not to change folder permissions. I tried to add "total control" in advanced options with no success.

z288.jpg
z288.jpg (386.15 KiB) Viewed 60969 times
z289.jpg
z289.jpg (367.19 KiB) Viewed 60969 times
Oleg
Site Admin
Posts: 3088
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Backup your tasks

Post by Oleg »

Try to remove folder c:\taskBackup\20220425 manually in Windows Explorer.
I'm sure that you will get the same error
Also, check the folder contents. I'm sure that the folder is already empty.
Oleg Yershov
cagigas
Posts: 10
Joined: Mon Apr 18, 2022 10:57 am

Re: Backup your tasks

Post by cagigas »

Yes, the folder is empty, but I can delete the folder manually without error messages; it goes directly to recicle bin.

I suspect of sharing access rights, or Robotask does not have permissions to delete folders, although I have deleted folders before with Robotask and it went fine

Very extrange :(((
Oleg
Site Admin
Posts: 3088
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Backup your tasks

Post by Oleg »

...it goes directly to recicle bin.
Moving to Recycled BIN and delete folder (without recycled bin) are not the same operations.
To delete file or folder without recycled bin select the file and use keys Shift+Del
...or Robotask does not have permissions to delete folders...
RoboTask has exactly the same permissions as other applications in your session by default
Oleg Yershov
cagigas
Posts: 10
Joined: Mon Apr 18, 2022 10:57 am

Re: Backup your tasks

Post by cagigas »

Oleg, the problem is in the "Syncronize folders" step. It locks the folder, hence the access error message.
Please have a look at this simple task:

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|0
CatID=INTEGER|1023498607
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task60"
Hide=INTEGER|0
ID=INTEGER|936654536
LogOnAsUser=INTEGER|1
Name=STRING|"BorrarCarpeta"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER

[Actions\Action1]
ActionID=STRING|"A_FOLDER_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create Folder (C:\TaskBackup\test)"
Params=FOLDER

[Actions\Action1\Params]
newfolder=STRING|"C:\TaskBackup\test"

[Actions\Action2]
ActionID=STRING|"A_GENERAL_PAUSE"
Enabled=INTEGER|-1
Name=STRING|"Delay 5 sec"
Params=FOLDER

[Actions\Action2\Params]
delay=STRING|"5"
dimension=STRING|"1"

[Actions\Action3]
ActionID=STRING|"A_FOLDER_REMOVE"
Enabled=INTEGER|-1
Name=STRING|"Remove Nonempty Folder  (C:\TaskBackup\Test)"
Params=FOLDER

[Actions\Action3\Params]
deletefolder=STRING|"1"
folder=STRING|"C:\TaskBackup\Test"

It works perfectly in my computer. It creates a folder "test" and then it deletes it. No errors, no problems.
I can also delete folders with Robotask that I have created manually before.

The step "syncronize folders" is locking the folders. These folders are locked in a way that even if I copy and rename them I still cannot remove them.

Thanks,
Oscar
cagigas
Posts: 10
Joined: Mon Apr 18, 2022 10:57 am

Re: Backup your tasks

Post by cagigas »

(edited to remove incorrect code)
Last edited by cagigas on Wed May 04, 2022 11:14 am, edited 1 time in total.
Oleg
Site Admin
Posts: 3088
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Backup your tasks

Post by Oleg »

The step "syncronize folders" is locking the folders.
I use the task with "Synchronize folders" step several years without problem.
It seems the problem is not here
Oleg Yershov
cagigas
Posts: 10
Joined: Mon Apr 18, 2022 10:57 am

Re: Backup your tasks

Post by cagigas »

Just for your information, I have changed the "Delete non-empty folder" step to "delete file (with folder)" step and it works fine now. There seems to be a problem with "delete folder" in my computer.
z324.gif
z324.gif (213.77 KiB) Viewed 60902 times
Post Reply