AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Simple loop question

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
david.kingham



Joined: 06 Nov 2007
Posts: 24

PostPosted: Tue Nov 17, 2009 8:38 pm    Post subject: Simple loop question Reply with quote

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%
Back to top
View user's profile Send private message
Carcophan



Joined: 24 Dec 2008
Posts: 768
Location: :noitacoL

PostPosted: Tue Nov 17, 2009 8:42 pm    Post subject: Re: Simple loop question Reply with quote

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.


_________________
"Unfortunately a "COM for Dummies" book would be a little like "Neurosurgery for Dummies," in the end you're just gonna have to learn" ~Tank
Back to top
View user's profile Send private message AIM Address
None
Guest





PostPosted: Tue Nov 17, 2009 10:05 pm    Post subject: Reply with quote

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
Back to top
david.kingham



Joined: 06 Nov 2007
Posts: 24

PostPosted: Tue Nov 17, 2009 10:16 pm    Post subject: Reply with quote

I overcomplicated the crap out of that didn't I? Thanks for the easy solution
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group