GetFileList

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
snapper1969
Pro Scripter
Posts: 50
Joined: Fri Mar 23, 2007 10:14 am

GetFileList

Post by snapper1969 » Thu Aug 07, 2008 7:41 pm

Hi,

I'm using the following to copy a specific file to a directory and it works well:

GetFileList>C:\temp\sally\jda*.xls,files
Separate>files,;,file_names
Day>the_day
Month>the_month
Year>the_year
Let>thisday=%the_year%%the_month%%the_day%
Let>k=0
Repeat>k
Let>k=k+1
FileDate>file_names_%k%,fdate
if>fdate=thisday,copyfile
Goto>continue
Label>copyfile
CopyFile>file_names_%k%,C:\Temp\Sally\Archive
Label>continue
endif
Until>k,file_names_count

There are quite a few other specific files that I need to copy. Other than using the above for every file is there anyway that it can be simplified?.

thx,

John

GarryP
Junior Coder
Posts: 27
Joined: Sat Feb 04, 2006 12:01 pm

Post by GarryP » Thu Aug 07, 2008 7:59 pm

Let>filelistsource=C:\temp\sally\jda*.xls
Let>filelistdestination=C:\Telmp\Sally\Archive
GoSub>performarchive

Let>filelistsource=C:\temp\jessie\xyz*.doc
Let>filelistdestination=C:\Telmp\jessie\Archive
GoSub>performarchive

Let>filelistsource=C:\temp\raphael\abc*.jpg
Let>filelistdestination=C:\Telmp\raphael\Archive
GoSub>performarchive

Goto>very_end

SRT>performarchive
GetFileList>%filelistsource%,files
Separate>files,;,file_names
Day>the_day
Month>the_month
Year>the_year
Let>thisday=%the_year%%the_month%%the_day%
Let>k=0
Repeat>k
Let>k=k+1
FileDate>file_names_%k%,fdate
if>fdate=thisday,copyfile
Goto>continue
Label>copyfile
CopyFile>file_names_%k%,%filelistdestination%
Label>continue
endif
Until>k,file_names_count
End>performarchive

Label>very_end

snapper1969
Pro Scripter
Posts: 50
Joined: Fri Mar 23, 2007 10:14 am

GetFileList

Post by snapper1969 » Thu Aug 07, 2008 8:08 pm

Gary,

Thx, that looks gr8 --- very simple even for me :)

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Aug 07, 2008 8:43 pm

Goto>very_end and Label>very_end are not needed. The subroutine will only be executed if it is called.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts