AutoHotkey Community

It is currently May 26th, 2012, 11:26 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Simple loop question
PostPosted: November 17th, 2009, 9:38 pm 
Offline

Joined: November 6th, 2007, 7:24 pm
Posts: 24
I'm just trying to delete any file in the temp folder that begins with revittemp, seems I'm missing something very obvious

Code:
         FileList =
         Loop %temp%\revittemp*
            FileList = %FileList%%A_LoopFileFullPath% `n
         Loop, Parse, FileList, `n
            FileDelete %A_LoopField%


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Simple loop question
PostPosted: November 17th, 2009, 9:42 pm 
Offline

Joined: December 24th, 2008, 3:25 am
Posts: 1401
Location: :noitacoL
david.kingham wrote:
Code:
         FileList =
         Loop %temp%\revittemp*
            FileList = %FileList%%A_LoopFileFullPath% `n
         Loop, Parse, FileList, `n
            FileDelete %A_LoopField%




Is this your actual code or a snippet?


Quote:
The One True Brace (OTB) style may optionally be used with normal loops (but not specialized loops such as file-pattern and parsing). For example:

Loop
{
...
}

Loop %RepeatCount%
{
...
}

Specialized loops: Loops can be used to automatically retrieve files, folders, or registry items (one at a time). See file-loop and registry-loop for details. In addition, file-reading loops can operate on the entire contents of a file, one line at a time. Finally, parsing loops can operate on the individual fields contained inside a delimited string.



Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 17th, 2009, 11:05 pm 
FileDelete, FilePattern

Parameters
FilePattern The name of a single file or a wildcard pattern such as C:\Temp\*.tmp. FilePattern is assumed to be in %A_WorkingDir% if an absolute path isn't specified.

To remove an entire folder, along with all its sub-folders and files, use FileRemoveDir

Code:
FileDelete, C:\Temp\revittemp*.* ;Change to your temp folder


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 17th, 2009, 11:16 pm 
Offline

Joined: November 6th, 2007, 7:24 pm
Posts: 24
I overcomplicated the crap out of that didn't I? Thanks for the easy solution


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Cerberus, Google [Bot], Leef_me, Maestr0, rbrtryn, XstatyK, Yahoo [Bot] and 73 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group