Moving files

Discuss RoboTask here
Post Reply
steph@vds
Posts: 46
Joined: Tue Nov 29, 2005 11:27 pm
Location: France

Moving files

Post by steph@vds »

Hi everyone,
I'm a new user of Robotask and I wonder how to simply move files. When
I create a task to do this I'm in front of a minor problem. I explain
myself : if I search all the .m2v files in a directory that contains a
lot of subfolders and I ask to Robotask to move these files, Robotask
also moves the subfolders that contain those files. What is the good
method to move files without the subfolders ?
My task is containing to 2 actions "Browse for folders" to ask the user where are the source files and where to move them.
I also made an action "create File list" but till now it is useless
because I don't know what to do with this File list (even if I write
this list in a text file).
If anybody can help me, it will be welcome.
Thanks.
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Moving files

Post by Oleg »

I've understood your task so:
You need to move some files from one folder to another and you want to preserve the folder structure. Right?
If you simply move files then folder structure will be lost.

Some later I shall post here an example, how to move files with folder structure.
steph@vds
Posts: 46
Joined: Tue Nov 29, 2005 11:27 pm
Location: France

Moving files

Post by steph@vds »

Hi Oleg,
First of all I would thank you for your quick response.

Just to precise my problem : I don't want to keep my folder structure, I just want to gather files according to their type.

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

Moving files

Post by Oleg »

See task below. This task copies files *.m2v from selected folder into c:\dest
Save text of task to file and use menu Task | Import to import into RoboTask

;**********************
;* RoboTask Task file *
;* Do not edit!       *
;**********************

[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|565106205
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task345"
Hide=INTEGER|0
ID=INTEGER|710068702
Name=STRING|"copy files by mask"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3

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

[Actions\Action1]
ActionID=STRING|"A_DIALOG_BROWSEFOLDERS"
Enabled=INTEGER|-1
Name=STRING|"Browse for Folders"
Params=FOLDER

[Actions\Action1\Params]
caption=STRING|"Select Sourse Folder"
default=STRING|"None"
filter=STRING|"Text files|*.txt|All files|*.*|"
variable=STRING|"S_FOLDER"

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

[Actions\Action2\Params]
case=STRING|"0"
operator=STRING|"1"
type=STRING|"0"
value1=STRING|"s_folder"
value2=STRING|"None"

[Actions\Action3]
ActionID=STRING|"A_FILE_SEARCH"
Enabled=INTEGER|-1
Name=STRING|"Create File List (c:\files_to_move.txt)"
Params=FOLDER

[Actions\Action3\Params]
After=STRING|"0"
aftercount=STRING|"0"
AfterLine=STRING|"0"
Before=STRING|"0"
beforecount=STRING|"0"
BeforeLine=STRING|"0"
createmode=STRING|"1"
date1=STRING|"20051201"
date2=STRING|"20051201"
destfile=STRING|"c:\files_to_move.txt"
DuringDays=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"{s_folder}\*.m2v"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderMonths=STRING|"1"
searchkind=STRING|"0"
subdirs=STRING|"1"
WithoutPath=STRING|"0"

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

[Actions\Action4\Params]
destdir=STRING|"c:\dest"
f_count=STRING|"1"
file0=STRING|"{TextFile(c:\files_to_move.txt)}"
ifexists=STRING|"1"
move=STRING|"1"
subdir=STRING|"0"

[Actions\Action5]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
steph@vds
Posts: 46
Joined: Tue Nov 29, 2005 11:27 pm
Location: France

Moving files

Post by steph@vds »

Hi Oleg,
I tried your task unsuccessfully. Robotask always indicate an error on Step#3 (copy/move).
I've build a new task from yours to show you the behaviour I expect
from my task (ask the user the source folder and the destinations
folders for all files). I've got the same error.
My variables actually have the following Initial Values (they're
constant for the moment because I'm always testing my task in the same
folders) :
S_FOLDER : (C:\TEST ROBOTASK\SOURCE)
EXCEL_FOLDER : (C:\TEST ROBOTASK\DESTINATION\XLS)
WORD_FOLDER : (C:\TEST ROBOTASK\DESTINATION\DOC)

(The search files and Write to Text actions are always successfull)

I have a doubt about the syntax in the copy/move action. What do you think about that ?

Steph.

;**********************
;* RoboTask Task file *
;* Do not edit!       *
;**********************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|0
CatID=INTEGER|2001545326
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task3"
Hide=INTEGER|0
ID=INTEGER|1082868310
Name=STRING|"Word & Excel"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER

[Actions\Action1]
ActionID=STRING|"A_DIALOG_BROWSEFOLDERS"
Enabled=INTEGER|-1
Name=STRING|"Browse for Folders"
Params=FOLDER

[Actions\Action1\Params]
caption=STRING|"Select source folder"
default=STRING|"None"
filter=STRING|"Text files|*.txt|All files|*.*|"
variable=STRING|"S_FOLDER"

[Actions\Action2]
ActionID=STRING|"A_DIALOG_BROWSEFOLDERS"
Enabled=INTEGER|-1
Name=STRING|"Browse for Folders"
Params=FOLDER

[Actions\Action2\Params]
caption=STRING|"Select Destination folder for the .doc files"
default=STRING|"None"
filter=STRING|"Text files|*.txt|All files|*.*|"
variable=STRING|"{WORD_FOLDER}"

[Actions\Action3]
ActionID=STRING|"A_DIALOG_BROWSEFOLDERS"
Enabled=INTEGER|-1
Name=STRING|"Browse for Folders"
Params=FOLDER

[Actions\Action3\Params]
caption=STRING|"Select Destination folder for the .xls files"
default=STRING|"None"
filter=STRING|"Text files|*.txt|All files|*.*|"
variable=STRING|"{EXCEL_FOLDER}"

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

[Actions\Action4\Params]
case=STRING|"0"
operator=STRING|"1"
type=STRING|"0"
value1=STRING|"s_folder"
value2=STRING|"None"

[Actions\Action5]
ActionID=STRING|"A_FILE_SEARCH"
Enabled=INTEGER|-1
Name=STRING|"Create File List ({WORD_FOLDER}\doc.txt)"
Params=FOLDER

[Actions\Action5\Params]
After=STRING|"0"
aftercount=STRING|"0"
AfterLine=STRING|"0"
Before=STRING|"0"
beforecount=STRING|"0"
BeforeLine=STRING|"0"
createmode=STRING|"1"
date1=STRING|"20051201"
date2=STRING|"20051201"
destfile=STRING|"{WORD_FOLDER}\doc.txt"
DuringDays=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"{s_folder}\*.doc"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderMonths=STRING|"1"
subdirs=STRING|"1"
WithoutPath=STRING|"0"

[Actions\Action6]
ActionID=STRING|"A_FILE_SEARCH"
Enabled=INTEGER|-1
Name=STRING|"Create File List ({EXCEL_FOLDER}\xls.txt)"
Params=FOLDER

[Actions\Action6\Params]
After=STRING|"0"
aftercount=STRING|"0"
AfterLine=STRING|"0"
Before=STRING|"0"
beforecount=STRING|"0"
BeforeLine=STRING|"0"
createmode=STRING|"1"
date1=STRING|"20051201"
date2=STRING|"20051201"
destfile=STRING|"{EXCEL_FOLDER}\xls.txt"
DuringDays=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"{s_folder}\*.xls"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderMonths=STRING|"1"
subdirs=STRING|"1"
WithoutPath=STRING|"0"

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

[Actions\Action7\Params]
destdir=STRING|"{WORD_FOLDER}"
f_count=STRING|"1"
file0=STRING|"{TextFile({WORD_FOLDER}\doc.txt)}"
ifexists=STRING|"1"
move=STRING|"1"
subdir=STRING|"0"

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

[Actions\Action8\Params]
destdir=STRING|"{EXCEL_FOLDER}"
f_count=STRING|"1"
file0=STRING|"{TextFile({EXCEL_FOLDER}\xls.txt)}"
ifexists=STRING|"1"
move=STRING|"1"
subdir=STRING|"0"

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


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

Moving files

Post by Oleg »

I've just tested your example with your foldernames:
S_FOLDER : (C:\TEST ROBOTASK\SOURCE)
EXCEL_FOLDER : (C:\TEST ROBOTASK\DESTINATION\XLS)
WORD_FOLDER : (C:\TEST ROBOTASK\DESTINATION\DOC)

It works fine!

Can you send error messages from task's log?
What version of RoboTask are you using?
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Moving files

Post by Oleg »

I tried your task unsuccessfully. Robotask always indicate an error on Step#3 (copy/move).
Oh, sorry
My example uses stipulated folder c:\dest
If this folder doesn't exists on your computer, you need to create it or change the task.
steph@vds
Posts: 46
Joined: Tue Nov 29, 2005 11:27 pm
Location: France

Moving files

Post by steph@vds »

Oleg,
Here is the error log from Robotask 2.2.1 :

I: 01/12/2005 14:56:32: ****** Starting task... ******************
I: 01/12/2005 14:56:32: Task started with priority: Normal
I: 01/12/2005 14:56:32: Executing "Browse for Folders"
I: 01/12/2005 14:56:37: Executing "Browse for Folders"
I: 01/12/2005 14:56:44: Executing "Browse for Folders"
I: 01/12/2005 14:56:48: Executing "If Then"
I: 01/12/2005 14:56:48: Executing "Create File List ({WORD_FOLDER}\doc.txt)"
I: 01/12/2005 14:56:48: Executing "Create File List ({EXCEL_FOLDER}\xls.txt)"
I: 01/12/2005 14:56:48: Executing "Copy/Move File"
E: 01/12/2005 14:56:48: An error occured. Step #6 (Copy/Move File).
E: 01/12/2005 14:56:48: Task execution is aborted

About your task, I changed the c:\dest to C:\TEST ROBOTASK\DESTINATION

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

Moving files

Post by Oleg »

Ok.
You have two ways:

1. Download and install new version of RoboTask (current version is 2.3)
We have fixed this bug.

2. Use the loops to move files one by one. See task below.

;**********************
;* RoboTask Task file *
;* Do not edit!       *
;**********************

[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|0
CatID=INTEGER|1614811947
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task350"
Hide=INTEGER|0
ID=INTEGER|1334739928
Name=STRING|"Word & Excel (with loops)"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3

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

[Actions\Action1]
ActionID=STRING|"A_DIALOG_BROWSEFOLDERS"
Enabled=INTEGER|-1
Name=STRING|"Browse for Folders"
Params=FOLDER

[Actions\Action1\Params]
caption=STRING|"Select source folder"
default=STRING|"None"
filter=STRING|"Text files|*.txt|All files|*.*|"
variable=STRING|"S_FOLDER"

[Actions\Action10]
ActionID=STRING|"A_LOOP_TEXT"
Enabled=INTEGER|-1
Name=STRING|"Text Loop"
Params=FOLDER

[Actions\Action10\Params]
destvar=STRING|"FILE_TO_MOVE"
file=STRING|"{EXCEL_FOLDER}\xls.txt"
linecount=STRING|"0"
sourcetext=STRING|"0"

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

[Actions\Action11\Params]
destdir=STRING|"{EXCEL_FOLDER}"
f_count=STRING|"1"
file0=STRING|"{file_to_move}"
ifexists=STRING|"1"
move=STRING|"1"
subdir=STRING|"0"

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

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

[Actions\Action2]
ActionID=STRING|"A_DIALOG_BROWSEFOLDERS"
Enabled=INTEGER|-1
Name=STRING|"Browse for Folders"
Params=FOLDER

[Actions\Action2\Params]
caption=STRING|"Select Destination folder for the .doc files"
default=STRING|"None"
filter=STRING|"Text files|*.txt|All files|*.*|"
variable=STRING|"{WORD_FOLDER}"

[Actions\Action3]
ActionID=STRING|"A_DIALOG_BROWSEFOLDERS"
Enabled=INTEGER|-1
Name=STRING|"Browse for Folders"
Params=FOLDER

[Actions\Action3\Params]
caption=STRING|"Select Destination folder for the .xls files"
default=STRING|"None"
filter=STRING|"Text files|*.txt|All files|*.*|"
variable=STRING|"{EXCEL_FOLDER}"

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

[Actions\Action4\Params]
case=STRING|"0"
operator=STRING|"1"
type=STRING|"0"
value1=STRING|"s_folder"
value2=STRING|"None"

[Actions\Action5]
ActionID=STRING|"A_FILE_SEARCH"
Enabled=INTEGER|-1
Name=STRING|"Create File List ({WORD_FOLDER}\doc.txt)"
Params=FOLDER

[Actions\Action5\Params]
After=STRING|"0"
aftercount=STRING|"0"
AfterLine=STRING|"0"
Before=STRING|"0"
beforecount=STRING|"0"
BeforeLine=STRING|"0"
createmode=STRING|"1"
date1=STRING|"20051201"
date2=STRING|"20051201"
destfile=STRING|"{WORD_FOLDER}\doc.txt"
DuringDays=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"{s_folder}\*.doc"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderMonths=STRING|"1"
subdirs=STRING|"1"
WithoutPath=STRING|"0"

[Actions\Action6]
ActionID=STRING|"A_FILE_SEARCH"
Enabled=INTEGER|-1
Name=STRING|"Create File List ({EXCEL_FOLDER}\xls.txt)"
Params=FOLDER

[Actions\Action6\Params]
After=STRING|"0"
aftercount=STRING|"0"
AfterLine=STRING|"0"
Before=STRING|"0"
beforecount=STRING|"0"
BeforeLine=STRING|"0"
createmode=STRING|"1"
date1=STRING|"20051201"
date2=STRING|"20051201"
destfile=STRING|"{EXCEL_FOLDER}\xls.txt"
DuringDays=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"{s_folder}\*.xls"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderMonths=STRING|"1"
subdirs=STRING|"1"
WithoutPath=STRING|"0"

[Actions\Action7]
ActionID=STRING|"A_LOOP_TEXT"
Enabled=INTEGER|-1
Name=STRING|"Text Loop"
Params=FOLDER

[Actions\Action7\Params]
destvar=STRING|"FILE_TO_MOVE"
file=STRING|"{WORD_FOLDER}\doc.txt"
linecount=STRING|"0"
sourcetext=STRING|"0"

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

[Actions\Action8\Params]
destdir=STRING|"{WORD_FOLDER}"
f_count=STRING|"1"
file0=STRING|"{file_to_move}"
ifexists=STRING|"1"
move=STRING|"1"
subdir=STRING|"0"

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


Last edited by Oleg on Thu Dec 01, 2005 9:40 am, edited 1 time in total.
steph@vds
Posts: 46
Joined: Tue Nov 29, 2005 11:27 pm
Location: France

Moving files

Post by steph@vds »

Hi Oleg,

Thanks a lot, now with the version 2.3 it works very well. I will purchase the software tomorrow. I'm convinced.

See you next time.

Steph.
Post Reply