File move app part 2
bob at armbase.com
Sat Dec 6 10:45:49 EST 2003
I have created an app to move selective files based on their filetype and
(sometimes) included text.
This code (below) lets you choose a directory, walk it and view a list. OK
so far. Now on my second weekend learning revolution; I have linked a
checkbox to a filter. :-) In my edited section I filter gHierList depending
on whether one button is pressed. However, If I want to filter for two (eg
jpg and gif) I double filter and end up with no selection.
I thought of creating a global eg gBobList and on each line create a local
variable eg bobgif. Then would copy ghierlist into the local variable,
filter the local and add to the final global (boblist). I need a global
since another button will do something with this. In addition I want to
view the list in the window.
Can anyone think of a simpler way?
put empty into gHierList
put empty into field 1
answer folder "Pick a folder you want to walk:"
if it is empty then exit mouseUp
set lockCursor to true
set cursor to watch
-- I added this bit today
if the hilite of button "JPEG" is true then filter gHierlist with "*.jpg"
if the hilite of button "BIORAD" is true then filter gHierlist with
if the hilite of button "GIF" is true then filter gHierlist with "*.gif"
-- end of my edit
put gHierList into field 1
put number of lines of fld 1
set lockCursor to false
on directoryWalk whatFolder
set the defaultFolder to whatFolder
put the files into temp
repeat for each line x in temp
put whatFolder & "/" & x & return after gHierList
put the folders into tDirList
repeat with x = 2 to the number of lines of tDirList
directoryWalk (whatFolder & "/" & (line x of tDirList))
More information about the Use-livecode