GetFileList and IfFileExists problems

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
gummybear
Newbie
Posts: 4
Joined: Mon Apr 26, 2010 1:55 pm

GetFileList and IfFileExists problems

Post by gummybear » Mon Aug 02, 2010 2:54 pm

Hello all,

I am trying to copy files from one folder to another.

Source = C:\Temp
Destination = C:\Temp2

I want to run the macro every 10 minutes or so, and copy NEW files from Source to Destination.

My problem is, the results for GetFileList doesn't just give the file name, but its entire path like file_names_1 = C:\Temp\File1.txt

So I can't use IfFileExists on C:\Temp2\file_names_%1%. I think it would come out like C:\Temp2\C:\Temp\File1.txt which doesn't work.

The template I'm using is:

Code: Select all

GetFileList>c:\temp\*.*,files
Separate>files,;,file_names

Let>k=0

Repeat>k
  Let>k=k+1
  IfFileExists>C:\Temp2\something
     *Do nothing*
  Else
     *CopyFile*
  Endif
Until>k,file_names_count
I don't have any programming experience so I'm asking for help in simple Macro Scheduler language commands. Thank you.

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

Post by Marcus Tettmar » Mon Aug 02, 2010 4:27 pm

So I can't use IfFileExists on C:\Temp2\file_names_%1%. I think it would come out like C:\Temp2\C:\Temp\File1.txt which doesn't work.
So you could do:

Let>this_file=file_names_%k%
StringReplace>this_file,Temp,Temp2,this_file
IfFileExists>this_file
..
..
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

gummybear
Newbie
Posts: 4
Joined: Mon Apr 26, 2010 1:55 pm

Post by gummybear » Mon Aug 02, 2010 5:42 pm

That works perfectly, thank you.

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