File Saerch

Discuss RoboTask here
Danarlidge
Posts: 8
Joined: Thu Apr 13, 2023 9:45 am

File Saerch

Post by Danarlidge »

I'm trying to create a task that does the following:

1. Search a “Deliverables” folder for any files older than 45 days & move them to somewhere else, including the complete original folder path.

2. Search “new location” for any files that have been moved there over 30 days ago and delete them

3. Search the “Deliverables” folder for any empty folders that were created more than 45 days ago and delete

And for steps 1 and 3, there is one folder that I want to exclude from being moved or deleted.


Right now, for step 1, I'm trying to do a file search to find all the files I want to move over, and this does a complete file structure so i can then take the output text file of files that are older than 45days and then give that text file to the Synchronize folders task. But, my problem is when I'm doing a file search, I want to exclude a folder, but it doesn't appear to work.

Here is a screenshot of both my search for files task and Sync folders task: https://imgur.com/a/3oIAn4N
Oleg
Site Admin
Posts: 3011
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: File Saerch

Post by Oleg »

But, my problem is when I'm doing a file search, I want to exclude a folder, but it doesn't appear to work.
Yes the action does not allow to exclude folders.
But you can create the file list by using File loop and add condition into the loop.
Look at the example below
Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.
Also you can simply copy task text and paste it into the task list.

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1163085779
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task72"
Hide=INTEGER|0
ID=INTEGER|1748979136
LogOnAsUser=INTEGER|1
Name=STRING|"Create list and exclude some folder"
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
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""Folder"" with value ""D:\incoming\test"""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"Folder"
varvalue=STRING|"D:\incoming\test"

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""exclude"" with value ""D:\incoming\test\attach"""
Params=FOLDER

[Actions\Action2\Params]
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"exclude"
varvalue=STRING|"D:\incoming\test\attach"

[Actions\Action3]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""List"" with value """""
Params=FOLDER

[Actions\Action3\Params]
expand=STRING|"0"
linecount=STRING|"0"
varname=STRING|"List"

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

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

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

[Actions\Action5\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"9"
type=STRING|"0"
value1=STRING|"{Exclude}"
value2=STRING|"{FileName}"

[Actions\Action6]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""List"" with value ""{List}{FileName}{eol}"""
Params=FOLDER

[Actions\Action6\Params]
expand=STRING|"1"
linecount=STRING|"1"
varname=STRING|"List"
varvalue=STRING|"{List}{FileName}{eol}"

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

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

[Actions\Action9]
ActionID=STRING|"A_DIALOG_SHOWTEXT"
Enabled=INTEGER|-1
Name=STRING|"Show Text"
Params=FOLDER

[Actions\Action9\Params]
autoclose=STRING|"0"
fromfile=STRING|"1"
line00000000=STRING|"{List}"
linecount=STRING|"1"
timeout=STRING|"10"

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

Re: File Saerch

Post by Oleg »

2. Search “new location” for any files that have been moved there over 30 days ago and delete them
How do you want to detect that "file has been moved 30 days ago"?
The problem is that the date-time of the file will not be changed if you move the file. You can only detect files older than 30 days.
Oleg Yershov
Oleg
Site Admin
Posts: 3011
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: File Saerch

Post by Oleg »

3. Search the “Deliverables” folder for any empty folders that were created more than 45 days ago and delete
look at the example below how to remove empty folders

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1163085779
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task73"
Hide=INTEGER|0
ID=INTEGER|2016307933
LogOnAsUser=INTEGER|1
Name=STRING|"Delete empty folders"
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
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""Folder"" with value ""D:\incoming\test"""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"Folder"
varvalue=STRING|"D:\incoming\test"

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

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

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

[Actions\Action3\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"0"
type=STRING|"1"
value1=STRING|"{FilesCount({c_folder})}"
value2=STRING|"0"

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

[Actions\Action4\Params]
message=STRING|"Removing {c_folder}"
type=STRING|"3"

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

[Actions\Action5\Params]
deletefolder=STRING|"1"
folder=STRING|"{c_folder}"

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

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

Oleg Yershov
Danarlidge
Posts: 8
Joined: Thu Apr 13, 2023 9:45 am

Re: File Saerch

Post by Danarlidge »

Hi Oleg!

I hope all is well, and thank you so much for the assistance with this!

This task below works a treat! I can now search my folder for files older than 45 days, Excluding ONE folder.

The next part now is to take the list of files this task has created and move those files (with their complete folder structure) to a new location.

I was thinking this would be possible with a Synchronize Folders action and have {FileName} for the Include Mask and {exclude} as the Exclude Mask, but when this Synchronize Folders action is run, it will sync the entirety of folder 1 to folder 2, which isn't what I want to happen. here is a picture of my Synchronize Folders action https://imgur.com/a/vmR9gnc

Using the copy/Move File action sort of works but doesn't allow me to copy the folder structure over and only copies the files. Unless I should be using two of these actions, one for files and one for folders?

Kind Regards,
Dan Arlidge

Oleg wrote: Tue Apr 18, 2023 12:41 pm
But, my problem is when I'm doing a file search, I want to exclude a folder, but it doesn't appear to work.
Yes the action does not allow to exclude folders.
But you can create the file list by using File loop and add condition into the loop.
Look at the example below
Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.
Also you can simply copy task text and paste it into the task list.

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1163085779
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task72"
Hide=INTEGER|0
ID=INTEGER|1748979136
LogOnAsUser=INTEGER|1
Name=STRING|"Create list and exclude some folder"
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
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""Folder"" with value ""D:\incoming\test"""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"Folder"
varvalue=STRING|"D:\incoming\test"

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""exclude"" with value ""D:\incoming\test\attach"""
Params=FOLDER

[Actions\Action2\Params]
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"exclude"
varvalue=STRING|"D:\incoming\test\attach"

[Actions\Action3]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""List"" with value """""
Params=FOLDER

[Actions\Action3\Params]
expand=STRING|"0"
linecount=STRING|"0"
varname=STRING|"List"

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

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

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

[Actions\Action5\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"9"
type=STRING|"0"
value1=STRING|"{Exclude}"
value2=STRING|"{FileName}"

[Actions\Action6]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""List"" with value ""{List}{FileName}{eol}"""
Params=FOLDER

[Actions\Action6\Params]
expand=STRING|"1"
linecount=STRING|"1"
varname=STRING|"List"
varvalue=STRING|"{List}{FileName}{eol}"

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

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

[Actions\Action9]
ActionID=STRING|"A_DIALOG_SHOWTEXT"
Enabled=INTEGER|-1
Name=STRING|"Show Text"
Params=FOLDER

[Actions\Action9\Params]
autoclose=STRING|"0"
fromfile=STRING|"1"
line00000000=STRING|"{List}"
linecount=STRING|"1"
timeout=STRING|"10"

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

Re: File Saerch

Post by Oleg »

If you want to copy (or move) files by your own criteria with folder structure you can do this in the loop directly.
But you must calculate destination folder before copy/move.
Synchronize folders copies files with folder structure, but it can not exclude folders and can not select files by file time.
Look at my example below. Maybe this is what you need

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1163085779
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task78"
Hide=INTEGER|0
ID=INTEGER|1114038149
LogOnAsUser=INTEGER|1
Name=STRING|"Copy files with structure and exclude some folder"
OnErrorTaskID=INTEGER|1879502808
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|2
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

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

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""SourceFolder"" with value ""D:\incoming\test"""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"SourceFolder"
varvalue=STRING|"D:\incoming\test"

[Actions\Action10]
ActionID=STRING|"A_STR_REPLACE"
Enabled=INTEGER|-1
Name=STRING|"STR Replace"
Params=FOLDER

[Actions\Action10\Params]
case=STRING|"0"
mode=STRING|"0"
replacement=STRING|"\"
source=STRING|"{NewFolder}"
substring=STRING|"\\"
variable=STRING|"NewFolder"

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

[Actions\Action11\Params]
message=STRING|"{Filename}"
type=STRING|"3"

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

[Actions\Action12\Params]
message=STRING|"{newFolder}"
type=STRING|"3"

[Actions\Action13]
ActionID=STRING|"A_MISC_COMMENT"
Enabled=INTEGER|-1
Name=STRING|"//end calculate target folder"
Params=FOLDER

[Actions\Action13\Params]
comment=STRING|"end calculate target folder"

[Actions\Action14]
ActionID=STRING|"A_FILE_COPY"
Enabled=INTEGER|-1
Name=STRING|"Copy/Move File"
Params=FOLDER

[Actions\Action14\Params]
destdir=STRING|"{NewFolder}"
f_count=STRING|"1"
file0=STRING|"{FileName}"
hidden=STRING|"1"
ifexists=STRING|"1"
move=STRING|"0"
rename=STRING|"0"
renamemask=STRING|"*.*.new"
subdir=STRING|"0"
system=STRING|"1"

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

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

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""exclude"" with value ""D:\incoming\test\attach"""
Params=FOLDER

[Actions\Action2\Params]
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"exclude"
varvalue=STRING|"D:\incoming\test\attach"

[Actions\Action3]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""DestFolder"" with value ""D:\dest"""
Params=FOLDER

[Actions\Action3\Params]
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"DestFolder"
varvalue=STRING|"D:\dest"

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

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

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

[Actions\Action5\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"9"
type=STRING|"0"
value1=STRING|"{Exclude}"
value2=STRING|"{FileName}"

[Actions\Action6]
ActionID=STRING|"A_MISC_COMMENT"
Enabled=INTEGER|-1
Name=STRING|"//calculate target folder"
Params=FOLDER

[Actions\Action6\Params]
comment=STRING|"calculate target folder"

[Actions\Action7]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""NewFolder"" with value ""{ExtractFilePath({FileName})}"""
Params=FOLDER

[Actions\Action7\Params]
expand=STRING|"1"
linecount=STRING|"1"
varname=STRING|"NewFolder"
varvalue=STRING|"{ExtractFilePath({FileName})}"

[Actions\Action8]
ActionID=STRING|"A_STR_REPLACE"
Enabled=INTEGER|-1
Name=STRING|"STR Replace"
Params=FOLDER

[Actions\Action8\Params]
case=STRING|"0"
mode=STRING|"1"
source=STRING|"{NewFolder}"
substring=STRING|"{SourceFolder}"
variable=STRING|"NewFolder"

[Actions\Action9]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""NewFolder"" with value ""{DestFolder}\{Newfolder}"""
Params=FOLDER

[Actions\Action9\Params]
expand=STRING|"1"
linecount=STRING|"1"
varname=STRING|"NewFolder"
varvalue=STRING|"{DestFolder}\{Newfolder}"

Oleg Yershov
Danarlidge
Posts: 8
Joined: Thu Apr 13, 2023 9:45 am

Re: File Saerch

Post by Danarlidge »

Hi Oleg,

Many thanks for the revised task! This is helpful!

I did have a couple of issues, one I was able to fix myself; in the second STR Replace, it was looking for \\ and replacing it with \, but this would break the true path to the network location, so i just made it search for \\ and replace with \\ and this seemed to get rid of this error:

E: 18/04/2023 17:23:31: Access violation at address 0000000055E8AB70 in module 'FileMan.rtp'. Read of address 0000000000000002
E: 18/04/2023 17:23:31: Failed execute 'ExecAction with exception: Access violation at address 0000000055E8AB70 in module 'FileMan.rtp'. Read of address 0000000000000002' (C:\Program Files\RoboTask\Plugins\Files\FileMan.rtp)

the 2nd issue I have is:
W: 18/04/2023 17:34:03: Can't copy file: \\192.168.11.114\Content\IT\Test1\TEST1aspera.txt
W: 18/04/2023 17:34:03: MAX_PATH was exceeded during the operation. (183)
E: 18/04/2023 17:34:03: An error occurred. Step #14 (Copy/Move File).
E: 18/04/2023 17:34:03: Task execution is aborted

for some context:
Source folder: \\192.168.11.114\Content\IT

Excluded folder: \\192.168.11.114\Content\IT\dontinclude

destination folder: \\192.168.11.114\Content\IT - Moved

the file path is less than 100 characters long so I'm thinking this is a Robotask limitation?

Oleg wrote: Tue Apr 18, 2023 4:39 pm If you want to copy (or move) files by your own criteria with folder structure you can do this in the loop directly.
But you must calculate destination folder before copy/move.
Synchronize folders copies files with folder structure, but it can not exclude folders and can not select files by file time.
Look at my example below. Maybe this is what you need

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1163085779
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task78"
Hide=INTEGER|0
ID=INTEGER|1114038149
LogOnAsUser=INTEGER|1
Name=STRING|"Copy files with structure and exclude some folder"
OnErrorTaskID=INTEGER|1879502808
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|2
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

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

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""SourceFolder"" with value ""D:\incoming\test"""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"SourceFolder"
varvalue=STRING|"D:\incoming\test"

[Actions\Action10]
ActionID=STRING|"A_STR_REPLACE"
Enabled=INTEGER|-1
Name=STRING|"STR Replace"
Params=FOLDER

[Actions\Action10\Params]
case=STRING|"0"
mode=STRING|"0"
replacement=STRING|"\"
source=STRING|"{NewFolder}"
substring=STRING|"\\"
variable=STRING|"NewFolder"

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

[Actions\Action11\Params]
message=STRING|"{Filename}"
type=STRING|"3"

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

[Actions\Action12\Params]
message=STRING|"{newFolder}"
type=STRING|"3"

[Actions\Action13]
ActionID=STRING|"A_MISC_COMMENT"
Enabled=INTEGER|-1
Name=STRING|"//end calculate target folder"
Params=FOLDER

[Actions\Action13\Params]
comment=STRING|"end calculate target folder"

[Actions\Action14]
ActionID=STRING|"A_FILE_COPY"
Enabled=INTEGER|-1
Name=STRING|"Copy/Move File"
Params=FOLDER

[Actions\Action14\Params]
destdir=STRING|"{NewFolder}"
f_count=STRING|"1"
file0=STRING|"{FileName}"
hidden=STRING|"1"
ifexists=STRING|"1"
move=STRING|"0"
rename=STRING|"0"
renamemask=STRING|"*.*.new"
subdir=STRING|"0"
system=STRING|"1"

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

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

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""exclude"" with value ""D:\incoming\test\attach"""
Params=FOLDER

[Actions\Action2\Params]
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"exclude"
varvalue=STRING|"D:\incoming\test\attach"

[Actions\Action3]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""DestFolder"" with value ""D:\dest"""
Params=FOLDER

[Actions\Action3\Params]
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"DestFolder"
varvalue=STRING|"D:\dest"

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

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

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

[Actions\Action5\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"9"
type=STRING|"0"
value1=STRING|"{Exclude}"
value2=STRING|"{FileName}"

[Actions\Action6]
ActionID=STRING|"A_MISC_COMMENT"
Enabled=INTEGER|-1
Name=STRING|"//calculate target folder"
Params=FOLDER

[Actions\Action6\Params]
comment=STRING|"calculate target folder"

[Actions\Action7]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""NewFolder"" with value ""{ExtractFilePath({FileName})}"""
Params=FOLDER

[Actions\Action7\Params]
expand=STRING|"1"
linecount=STRING|"1"
varname=STRING|"NewFolder"
varvalue=STRING|"{ExtractFilePath({FileName})}"

[Actions\Action8]
ActionID=STRING|"A_STR_REPLACE"
Enabled=INTEGER|-1
Name=STRING|"STR Replace"
Params=FOLDER

[Actions\Action8\Params]
case=STRING|"0"
mode=STRING|"1"
source=STRING|"{NewFolder}"
substring=STRING|"{SourceFolder}"
variable=STRING|"NewFolder"

[Actions\Action9]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""NewFolder"" with value ""{DestFolder}\{Newfolder}"""
Params=FOLDER

[Actions\Action9\Params]
expand=STRING|"1"
linecount=STRING|"1"
varname=STRING|"NewFolder"
varvalue=STRING|"{DestFolder}\{Newfolder}"

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

Re: File Saerch

Post by Oleg »

W: 18/04/2023 17:34:03: Can't copy file: \\192.168.11.114\Content\IT\Test1\TEST1aspera.txt
W: 18/04/2023 17:34:03: MAX_PATH was exceeded during the operation. (183)
The cause is incorrect double slash ("\\") in destination folder. Gould you give me the complete log file of the task?

Look at the corrected task below
It's necessary to remove 1-st slash if it exists (see steps #9-#15). The task is working in my configuration

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1163085779
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task78"
Hide=INTEGER|0
ID=INTEGER|1114038149
LogOnAsUser=INTEGER|1
Name=STRING|"Copy files with structure and exclude some folder"
OnErrorTaskID=INTEGER|1879502808
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|2
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
Action19=FOLDER
Action2=FOLDER
Action20=FOLDER
Action21=FOLDER
Action22=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""SourceFolder"" with value ""\\192.168.10.122\diskD\incoming\test"""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"SourceFolder"
varvalue=STRING|"\\192.168.10.122\diskD\incoming\test"

[Actions\Action10]
ActionID=STRING|"A_STR_EXTRACT"
Enabled=INTEGER|-1
Name=STRING|"STR Extract"
Params=FOLDER

[Actions\Action10\Params]
amount=STRING|"1"
from=STRING|"1"
source=STRING|"{NewFolder}"
variable=STRING|"FirstChar"

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

[Actions\Action11\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"0"
type=STRING|"0"
value1=STRING|"{FirstChar}"
value2=STRING|"\"

[Actions\Action12]
ActionID=STRING|"A_STR_EXTRACT"
Enabled=INTEGER|-1
Name=STRING|"STR Extract"
Params=FOLDER

[Actions\Action12\Params]
amount=STRING|"1000"
from=STRING|"2"
source=STRING|"{NewFolder}"
variable=STRING|"NewFolder"

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

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

[Actions\Action14\Params]
message=STRING|"{newFolder}"
type=STRING|"3"

[Actions\Action15]
ActionID=STRING|"A_MISC_COMMENT"
Enabled=INTEGER|-1
Name=STRING|"//end remove 1-st slash"
Params=FOLDER

[Actions\Action15\Params]
comment=STRING|"end remove 1-st slash"

[Actions\Action16]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""NewFolder"" with value ""{DestFolder}\{Newfolder}"""
Params=FOLDER

[Actions\Action16\Params]
expand=STRING|"1"
linecount=STRING|"1"
varname=STRING|"NewFolder"
varvalue=STRING|"{DestFolder}\{Newfolder}"

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

[Actions\Action17\Params]
message=STRING|"{newFolder}"
type=STRING|"3"

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

[Actions\Action18\Params]
message=STRING|"{Filename}"
type=STRING|"3"

[Actions\Action19]
ActionID=STRING|"A_MISC_COMMENT"
Enabled=INTEGER|-1
Name=STRING|"//end calculate target folder"
Params=FOLDER

[Actions\Action19\Params]
comment=STRING|"end calculate target folder"

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""exclude"" with value ""\\192.168.10.122\diskD\incoming\test\attach"""
Params=FOLDER

[Actions\Action2\Params]
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"exclude"
varvalue=STRING|"\\192.168.10.122\diskD\incoming\test\attach"

[Actions\Action20]
ActionID=STRING|"A_FILE_COPY"
Enabled=INTEGER|-1
Name=STRING|"Copy/Move File"
Params=FOLDER

[Actions\Action20\Params]
destdir=STRING|"{NewFolder}"
f_count=STRING|"1"
file0=STRING|"{FileName}"
hidden=STRING|"1"
ifexists=STRING|"1"
move=STRING|"0"
rename=STRING|"0"
renamemask=STRING|"*.*.new"
subdir=STRING|"0"
system=STRING|"1"

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

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

[Actions\Action3]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""DestFolder"" with value ""\\192.168.10.122\diskD\dest"""
Params=FOLDER

[Actions\Action3\Params]
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"DestFolder"
varvalue=STRING|"\\192.168.10.122\diskD\dest"

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

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

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

[Actions\Action5\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"9"
type=STRING|"0"
value1=STRING|"{Exclude}"
value2=STRING|"{FileName}"

[Actions\Action6]
ActionID=STRING|"A_MISC_COMMENT"
Enabled=INTEGER|-1
Name=STRING|"//calculate target folder"
Params=FOLDER

[Actions\Action6\Params]
comment=STRING|"calculate target folder"

[Actions\Action7]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""NewFolder"" with value ""{ExtractFilePath({FileName})}"""
Params=FOLDER

[Actions\Action7\Params]
expand=STRING|"1"
linecount=STRING|"1"
varname=STRING|"NewFolder"
varvalue=STRING|"{ExtractFilePath({FileName})}"

[Actions\Action8]
ActionID=STRING|"A_STR_REPLACE"
Enabled=INTEGER|-1
Name=STRING|"STR Replace"
Params=FOLDER

[Actions\Action8\Params]
case=STRING|"0"
mode=STRING|"1"
source=STRING|"{NewFolder}"
substring=STRING|"{SourceFolder}"
variable=STRING|"NewFolder"

[Actions\Action9]
ActionID=STRING|"A_MISC_COMMENT"
Enabled=INTEGER|-1
Name=STRING|"//remove 1-st slash"
Params=FOLDER

[Actions\Action9\Params]
comment=STRING|"remove 1-st slash"

Oleg Yershov
Danarlidge
Posts: 8
Joined: Thu Apr 13, 2023 9:45 am

Re: File Saerch

Post by Danarlidge »

Hi Oleg!

I hope all is well.

Thanks for your reply below. I resolved my issue by adding a \ to the destination folder on the Copy\Move File task; this still allows me to get rid of the \\ when creating the new file path and add the additional \ at the start of the network path!

Here is my complete task now:

Code: Select all

;;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|746611670
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
Events=FOLDER
ExternalName=STRING|"Copyfileswithstructureandexcludesomefolder"
Hide=INTEGER|0
ID=INTEGER|905432504
LogOnAsUser=INTEGER|1
Name=STRING|"1. Move Deliverables files with the folder structure and exclude _UNMANAGED"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|2
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
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""SourceFolder"" with value ""\\192.168.11.114\Content\Deliverables"""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"SourceFolder"
varvalue=STRING|"\\192.168.11.114\Content\Deliverables"

[Actions\Action10]
ActionID=STRING|"A_STR_REPLACE"
Enabled=INTEGER|-1
Name=STRING|"STR Replace"
Params=FOLDER

[Actions\Action10\Params]
case=STRING|"0"
mode=STRING|"0"
replacement=STRING|"\"
source=STRING|"{NewFolder}"
substring=STRING|"\\"
variable=STRING|"NewFolder"

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

[Actions\Action11\Params]
message=STRING|"{Filename}"
type=STRING|"3"

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

[Actions\Action12\Params]
message=STRING|"{newFolder}"
type=STRING|"3"

[Actions\Action13]
ActionID=STRING|"A_MISC_COMMENT"
Enabled=INTEGER|-1
Name=STRING|"//end calculate target folder"
Params=FOLDER

[Actions\Action13\Params]
comment=STRING|"end calculate target folder"

[Actions\Action14]
ActionID=STRING|"A_FILE_COPY"
Enabled=INTEGER|-1
Name=STRING|"Copy/Move File"
Params=FOLDER

[Actions\Action14\Params]
destdir=STRING|"\{NewFolder}"
f_count=STRING|"1"
file0=STRING|"{FileName}"
hidden=STRING|"1"
ifexists=STRING|"1"
move=STRING|"1"
rename=STRING|"0"
renamemask=STRING|"*.*.new"
subdir=STRING|"1"
system=STRING|"1"

[Actions\Action15]
ActionID=STRING|"A_FILE_TEXTWRITE"
Enabled=INTEGER|-1
Name=STRING|"Create text file \\192.168.11.114\Content\_Pending_Delete\_AutoMoveLogs\FilesMoved {DateTimeToFormat({Date},yyyy-mm-dd)}.txt"
Params=FOLDER

[Actions\Action15\Params]
encode=STRING|"0"
fileexists=STRING|"1"
filname=STRING|"\\192.168.11.114\Content\_Pending_Delete\_AutoMoveLogs\FilesMoved {DateTimeToFormat({Date},yyyy-mm-dd)}.txt"
line0=STRING|"{FileName}"
linecount=STRING|"1"
suppress=STRING|"0"

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

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

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""ExcludeFolder"" with value ""\\192.168.11.114\Content\Deliverables\_UNMANAGED"""
Params=FOLDER

[Actions\Action2\Params]
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"ExcludeFolder"
varvalue=STRING|"\\192.168.11.114\Content\Deliverables\_UNMANAGED"

[Actions\Action3]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""DestFolder"" with value ""\\192.168.11.114\Content\_Pending_Delete"""
Params=FOLDER

[Actions\Action3\Params]
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"DestFolder"
varvalue=STRING|"\\192.168.11.114\Content\_Pending_Delete"

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

[Actions\Action4\Params]
createmode=STRING|"5"
createormodified=STRING|"1"
date1=STRING|"20230418"
date2=STRING|"20230418"
destvar=STRING|"FILENAME"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
exclude=STRING|".pdf,"
file0=STRING|"{SourceFolder}\*.*"
filecount=STRING|"1"
OlderDays=STRING|"60"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"0"
sort=STRING|"0"
sortby=STRING|"0"
sortorder=STRING|"0"
subdirs=STRING|"1"
timesize=STRING|"0"
WithoutPath=STRING|"0"

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

[Actions\Action5\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"9"
type=STRING|"0"
value1=STRING|"{ExcludeFolder}"
value2=STRING|"{FileName}"

[Actions\Action6]
ActionID=STRING|"A_MISC_COMMENT"
Enabled=INTEGER|-1
Name=STRING|"//calculate target folder"
Params=FOLDER

[Actions\Action6\Params]
comment=STRING|"calculate target folder"

[Actions\Action7]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""NewFolder"" with value ""{ExtractFilePath({FileName})}"""
Params=FOLDER

[Actions\Action7\Params]
expand=STRING|"1"
linecount=STRING|"1"
varname=STRING|"NewFolder"
varvalue=STRING|"{ExtractFilePath({FileName})}"

[Actions\Action8]
ActionID=STRING|"A_STR_REPLACE"
Enabled=INTEGER|-1
Name=STRING|"STR Replace"
Params=FOLDER

[Actions\Action8\Params]
case=STRING|"0"
mode=STRING|"0"
source=STRING|"{NewFolder}"
substring=STRING|"{SourceFolder}"
variable=STRING|"NewFolder"

[Actions\Action9]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""NewFolder"" with value ""{DestFolder}\{Newfolder}"""
Params=FOLDER

[Actions\Action9\Params]
expand=STRING|"1"
linecount=STRING|"1"
varname=STRING|"NewFolder"
varvalue=STRING|"{DestFolder}\{Newfolder}"

[Events]
Event1=FOLDER

[Events\Event1]
Enabled=INTEGER|-1
EventID=STRING|"E_GENERAL_SHEDULER"
Name=STRING|"Scheduler(16/05/2023 15:40:00)"
Params=FOLDER
UniqueID=INTEGER|80692163

[Events\Event1\Params]
periodicity=STRING|"0"
startdate=STRING|"45062"
time0=STRING|"79200000"
timecount=STRING|"1"
wakeup=STRING|"0"

I did have a question regarding file path limits, Windows is hard limited to 255, and I wondered if it was possible to skip files with longer than 255 character file path instead of aborting the task entirely.

Kind Regards,
Dan
Oleg wrote: Tue Apr 18, 2023 7:19 pm
W: 18/04/2023 17:34:03: Can't copy file: \\192.168.11.114\Content\IT\Test1\TEST1aspera.txt
W: 18/04/2023 17:34:03: MAX_PATH was exceeded during the operation. (183)
The cause is incorrect double slash ("\\") in destination folder. Gould you give me the complete log file of the task?

Look at the corrected task below
It's necessary to remove 1-st slash if it exists (see steps #9-#15). The task is working in my configuration

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1163085779
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task78"
Hide=INTEGER|0
ID=INTEGER|1114038149
LogOnAsUser=INTEGER|1
Name=STRING|"Copy files with structure and exclude some folder"
OnErrorTaskID=INTEGER|1879502808
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|2
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
Action19=FOLDER
Action2=FOLDER
Action20=FOLDER
Action21=FOLDER
Action22=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""SourceFolder"" with value ""\\192.168.10.122\diskD\incoming\test"""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"SourceFolder"
varvalue=STRING|"\\192.168.10.122\diskD\incoming\test"

[Actions\Action10]
ActionID=STRING|"A_STR_EXTRACT"
Enabled=INTEGER|-1
Name=STRING|"STR Extract"
Params=FOLDER

[Actions\Action10\Params]
amount=STRING|"1"
from=STRING|"1"
source=STRING|"{NewFolder}"
variable=STRING|"FirstChar"

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

[Actions\Action11\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"0"
type=STRING|"0"
value1=STRING|"{FirstChar}"
value2=STRING|"\"

[Actions\Action12]
ActionID=STRING|"A_STR_EXTRACT"
Enabled=INTEGER|-1
Name=STRING|"STR Extract"
Params=FOLDER

[Actions\Action12\Params]
amount=STRING|"1000"
from=STRING|"2"
source=STRING|"{NewFolder}"
variable=STRING|"NewFolder"

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

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

[Actions\Action14\Params]
message=STRING|"{newFolder}"
type=STRING|"3"

[Actions\Action15]
ActionID=STRING|"A_MISC_COMMENT"
Enabled=INTEGER|-1
Name=STRING|"//end remove 1-st slash"
Params=FOLDER

[Actions\Action15\Params]
comment=STRING|"end remove 1-st slash"

[Actions\Action16]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""NewFolder"" with value ""{DestFolder}\{Newfolder}"""
Params=FOLDER

[Actions\Action16\Params]
expand=STRING|"1"
linecount=STRING|"1"
varname=STRING|"NewFolder"
varvalue=STRING|"{DestFolder}\{Newfolder}"

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

[Actions\Action17\Params]
message=STRING|"{newFolder}"
type=STRING|"3"

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

[Actions\Action18\Params]
message=STRING|"{Filename}"
type=STRING|"3"

[Actions\Action19]
ActionID=STRING|"A_MISC_COMMENT"
Enabled=INTEGER|-1
Name=STRING|"//end calculate target folder"
Params=FOLDER

[Actions\Action19\Params]
comment=STRING|"end calculate target folder"

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""exclude"" with value ""\\192.168.10.122\diskD\incoming\test\attach"""
Params=FOLDER

[Actions\Action2\Params]
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"exclude"
varvalue=STRING|"\\192.168.10.122\diskD\incoming\test\attach"

[Actions\Action20]
ActionID=STRING|"A_FILE_COPY"
Enabled=INTEGER|-1
Name=STRING|"Copy/Move File"
Params=FOLDER

[Actions\Action20\Params]
destdir=STRING|"{NewFolder}"
f_count=STRING|"1"
file0=STRING|"{FileName}"
hidden=STRING|"1"
ifexists=STRING|"1"
move=STRING|"0"
rename=STRING|"0"
renamemask=STRING|"*.*.new"
subdir=STRING|"0"
system=STRING|"1"

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

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

[Actions\Action3]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""DestFolder"" with value ""\\192.168.10.122\diskD\dest"""
Params=FOLDER

[Actions\Action3\Params]
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"DestFolder"
varvalue=STRING|"\\192.168.10.122\diskD\dest"

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

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

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

[Actions\Action5\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"9"
type=STRING|"0"
value1=STRING|"{Exclude}"
value2=STRING|"{FileName}"

[Actions\Action6]
ActionID=STRING|"A_MISC_COMMENT"
Enabled=INTEGER|-1
Name=STRING|"//calculate target folder"
Params=FOLDER

[Actions\Action6\Params]
comment=STRING|"calculate target folder"

[Actions\Action7]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""NewFolder"" with value ""{ExtractFilePath({FileName})}"""
Params=FOLDER

[Actions\Action7\Params]
expand=STRING|"1"
linecount=STRING|"1"
varname=STRING|"NewFolder"
varvalue=STRING|"{ExtractFilePath({FileName})}"

[Actions\Action8]
ActionID=STRING|"A_STR_REPLACE"
Enabled=INTEGER|-1
Name=STRING|"STR Replace"
Params=FOLDER

[Actions\Action8\Params]
case=STRING|"0"
mode=STRING|"1"
source=STRING|"{NewFolder}"
substring=STRING|"{SourceFolder}"
variable=STRING|"NewFolder"

[Actions\Action9]
ActionID=STRING|"A_MISC_COMMENT"
Enabled=INTEGER|-1
Name=STRING|"//remove 1-st slash"
Params=FOLDER

[Actions\Action9\Params]
comment=STRING|"remove 1-st slash"

Danarlidge
Posts: 8
Joined: Thu Apr 13, 2023 9:45 am

Re: File Saerch

Post by Danarlidge »

Hi Oleg,

I hope you are well.

Did you get a chance to look at the above regarding the skipping files longer than 255 characters?

Kind Regards,
Dan
Post Reply