Remove sub level folders

Discuss RoboTask here
rice1973
Posts: 86
Joined: Mon Jan 04, 2010 2:38 am
Location: Netherlands
Contact:

Remove sub level folders

Post by rice1973 »

Hello Oleg,

I need to remove sub level folders eg;

"387.60.009/Images/387.60.009/Lv2/*.*" ("*.*" are the
files)

Has to become;

"387.60.009/*.*" ("*.*" are the files)

So removed must be the folders "Images/387.60.009/Lv2"
but the "*.*" (are the files) must keep existing.

So content that is is "387.60.009/Images/387.60.009/Lv2/"
has to "move" to "387.60.009/"
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Remove sub level folders

Post by Oleg »

Do you guarantee that conflict of filenames will not appear?
How many sublevel folders in each folder?
rice1973
Posts: 86
Joined: Mon Jan 04, 2010 2:38 am
Location: Netherlands
Contact:

Remove sub level folders

Post by rice1973 »

Only the folder names containing the numbers change;

eg "387.60.009" can be "421.50.212" or "352.51.230".

Sublevels from top to bottom;

"387.60.009" contains folders "Images" and "HTML5" (this
folder must also be removed)

"Images" contains only folder "387.60.009"

"387.60.009" contains only folder "Lv2"

Maybe it's quicker / easier to move the content from
"387.60.009/Images/387.60.009/Lv2/" to "387.60.009"
(first folder) and then remove all the subfolders
rice1973
Posts: 86
Joined: Mon Jan 04, 2010 2:38 am
Location: Netherlands
Contact:

Remove sub level folders

Post by rice1973 »

Hello Oleg,

Can you hel me with the solution for above?
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Remove sub level folders

Post by Oleg »

See the example below.
Algorithm is simple. I thought that you can compose this task yourself...

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************

[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|2099193306
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task14"
Hide=INTEGER|0
ID=INTEGER|1967261896
LogOnAsUser=INTEGER|1
Name=STRING|"Remove sublevels"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action10=FOLDER
Action11=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 ""ROOTFOLDER"" with value ""d:\387.60.009"""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"ROOTFOLDER"
varvalue=STRING|"d:\387.60.009"

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

[Actions\Action11]
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 ""CURRENTFOLDER"" with value """""
Params=FOLDER

[Actions\Action2\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"CURRENTFOLDER"

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

[Actions\Action3\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"CURRENTFILE"

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

[Actions\Action4\Params]
createmode=STRING|"1"
date1=STRING|"20130117"
date2=STRING|"20130117"
destvar=STRING|"CURRENTFOLDER"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"{rootfolder}\*.*"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"1"
subdirs=STRING|"0"
timesize=STRING|"0"
WithoutPath=STRING|"0"

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

[Actions\Action5\Params]
createmode=STRING|"1"
date1=STRING|"20130117"
date2=STRING|"20130117"
destvar=STRING|"CURRENTFILE"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"{currentfolder}\*.*"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"0"
subdirs=STRING|"1"
timesize=STRING|"0"
WithoutPath=STRING|"0"

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

[Actions\Action6\Params]
destdir=STRING|"{rootfolder}"
f_count=STRING|"1"
file0=STRING|"{CurrentFile}"
hidden=STRING|"1"
ifexists=STRING|"1"
move=STRING|"1"
subdir=STRING|"0"
system=STRING|"1"

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

[Actions\Action7\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"1"
value1=STRING|"{FilesCount({currentfolder})}"
value2=STRING|"0"

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

[Actions\Action8\Params]
deletefolder=STRING|"1"
folder=STRING|"{currentfolder}"

[Actions\Action9]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
rice1973
Posts: 86
Joined: Mon Jan 04, 2010 2:38 am
Location: Netherlands
Contact:

Remove sub level folders

Post by rice1973 »

I am not that far .

mmh, the "d:\387.60.009" is a variable.(every folder has
another number "***.**.***")
How to fix that?
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Remove sub level folders

Post by Oleg »

You should do another one loop by folders by using the mask d:\???.??.???

* - any amount of any symbols
? - one any symbol
rice1973
Posts: 86
Joined: Mon Jan 04, 2010 2:38 am
Location: Netherlands
Contact:

Remove sub level folders

Post by rice1973 »

I will try ro fix it.
rice1973
Posts: 86
Joined: Mon Jan 04, 2010 2:38 am
Location: Netherlands
Contact:

Remove sub level folders

Post by rice1973 »

Wrong post...
Last edited by rice1973 on Thu Jan 17, 2013 11:29 pm, edited 1 time in total.
rice1973
Posts: 86
Joined: Mon Jan 04, 2010 2:38 am
Location: Netherlands
Contact:

Remove sub level folders

Post by rice1973 »

Hello Oleg,

Can't find the "mistake". Can you look?

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************

[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|0
CatID=INTEGER|0
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task14"
Hide=INTEGER|0
ID=INTEGER|1967261896
LogOnAsUser=INTEGER|1
Name=STRING|"Remove sublevels (imported)"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
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_LOOP_FILE"
Enabled=INTEGER|-1
Name=STRING|"File Loop"
Params=FOLDER

[Actions\Action1\Params]
createmode=STRING|"1"
date1=STRING|"20130117"
date2=STRING|"20130117"
destvar=STRING|"ROOTFOLDER"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"D:\???.??.???"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"1"
subdirs=STRING|"0"
timesize=STRING|"0"
WithoutPath=STRING|"0"

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

[Actions\Action10\Params]
createmode=STRING|"1"
date1=STRING|"20130117"
date2=STRING|"20130117"
destvar=STRING|"CURRENTFILE"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"{currentfolder}\*.*"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"0"
subdirs=STRING|"1"
timesize=STRING|"0"
WithoutPath=STRING|"0"

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

[Actions\Action11\Params]
destdir=STRING|"{rootfolder}"
f_count=STRING|"1"
file0=STRING|"{CurrentFile}"
hidden=STRING|"1"
ifexists=STRING|"1"
move=STRING|"1"
subdir=STRING|"0"
system=STRING|"1"

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

[Actions\Action12\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"1"
value1=STRING|"{FilesCount({currentfolder})}"
value2=STRING|"0"

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

[Actions\Action13\Params]
deletefolder=STRING|"1"
folder=STRING|"{currentfolder}"

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

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

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

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

[Actions\Action2\Params]
createmode=STRING|"1"
date1=STRING|"20130117"
date2=STRING|"20130117"
destvar=STRING|"ROOTFOLDER"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"D:\3dmap\???.??.???"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"1"
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"
operator=STRING|"6"
type=STRING|"0"
value1=STRING|"{Rootfolder({currentfolder})}"
value2=STRING|"0"

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

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

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

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

[Actions\Action7\Params]
expand=STRING|"0"
varname=STRING|"CURRENTFOLDER"

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

[Actions\Action8\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"CURRENTFILE"

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

[Actions\Action9\Params]
createmode=STRING|"1"
date1=STRING|"20130117"
date2=STRING|"20130117"
destvar=STRING|"CURRENTFOLDER"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"{rootfolder}\*.*"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"1"
subdirs=STRING|"0"
timesize=STRING|"0"
WithoutPath=STRING|"0"
Post Reply