Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Copy a file to new folder multiple times a day but not overwrite.


  • Please log in to reply
4 replies to this topic
bosmond
  • Members
  • 4 posts
  • Last active: Dec 22 2015 08:33 PM
  • Joined: 29 Jun 2015

Hello all,

 

I need a script to copy a .log file to a new folder every 30 min to the same folder.  This log file is different every 30 min.  I don't want the file to be overwritten.  I cant get the script to work properly.  the code i have is below.

 

FileCopy, D:3mhis\CONNPLUS\data\run_all.log, D:\3mhis\log file saves,

 

the file copies however it just moves the file.  I would like it to save as  run_all.log then run_all.log 1 then run_all.log 2 and so forth so i can see the data for a full day.

 

Any help would be greatly appreciated.

 

Ben

 



Exaskryz
  • Members
  • 3249 posts
  • Last active: Nov 20 2015 05:30 AM
  • Joined: 23 Aug 2012
SetTimer, copylog, 1800000
; no return so this runs immediately
 
copylog:
number:=0
Loop, Files, D:\3mhis\log file saves\, F
number++ ; this should count the files in your folder
FileCopy, D:3mhis\CONNPLUS\data\run_all.log, D:\3mhis\log file saves\run_all.log%number%
return

Maybe that's what you're looking for? SetTimer, LoopFile, operators (assign := and add-one ++), FileCopy, return



bosmond
  • Members
  • 4 posts
  • Last active: Dec 22 2015 08:33 PM
  • Joined: 29 Jun 2015

Thank you so much!!!!  May I ask what the F is for on line 6 ?



Exaskryz
  • Members
  • 3249 posts
  • Last active: Nov 20 2015 05:30 AM
  • Joined: 23 Aug 2012

F limits to just files (a D, if present, limits it to folders - "D" for Directory). I believe it's optional (as no options parameter there defaults to files), but I haven't worked with the LoopFile since the new syntax was introduced in a recent version.



bosmond
  • Members
  • 4 posts
  • Last active: Dec 22 2015 08:33 PM
  • Joined: 29 Jun 2015

Thanks for your help Exaskryz :)