Jump to content


Photo

File Append, non specific file


  • Please log in to reply
2 replies to this topic

#1 jmi

jmi
  • Members
  • 3 posts

Posted 14 May 2012 - 07:25 PM

Hello all,

I've created several autohotkey scripts which do there job perfectly! However, now I am trying to create a script which is somewhat over my head and any help would be greatly appreciated.

I want to make a script that will look in a specific directory (e.g. C:\Users\name\folder\) for a file with a specific extention (in this case .xml). The script would then do a fileappend and add a line to each file with that extension.

I know how to use the fileappend command, but I am unaware of how to set it so that it will look for a specific extension instead of a specific file. I would assume that a loop command would need to be used and possibly a regex to look for files with that extension but that is slightly above me right now.

Any suggestions?

Thanks!

#2 sinkfaze

sinkfaze
  • Moderators
  • 6089 posts

Posted 14 May 2012 - 07:27 PM

Loop, C:\Users\name\folder\*.xml
	FileAppend, [color=#800000]<< your stuff here >>[/color], %A_LoopFileLongPath%

:?:

#3 jmi

jmi
  • Members
  • 3 posts

Posted 14 May 2012 - 08:09 PM

That did the trick beautifully. I don't know why I never thought of the wildcard. Guess I was thinking too hard (or little)

Thanks for the help, skinfaze!