| View previous topic :: View next topic |
| Author |
Message |
david.kingham
Joined: 06 Nov 2007 Posts: 24
|
Posted: Tue Nov 17, 2009 8:38 pm Post subject: Simple loop question |
|
|
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 |
|
 |
Carcophan
Joined: 24 Dec 2008 Posts: 768 Location: :noitacoL
|
Posted: Tue Nov 17, 2009 8:42 pm Post subject: Re: Simple loop question |
|
|
| 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 |
|
 |
None Guest
|
Posted: Tue Nov 17, 2009 10:05 pm Post subject: |
|
|
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
|
Posted: Tue Nov 17, 2009 10:16 pm Post subject: |
|
|
| I overcomplicated the crap out of that didn't I? Thanks for the easy solution |
|
| Back to top |
|
 |
|