Anonymous user
Check that file exists: Difference between revisions
→{{header|AutoHotkey}}: Cleanup and example added
m (→{{header|PowerShell}}: lang tag) |
(→{{header|AutoHotkey}}: Cleanup and example added) |
||
Line 46:
=={{header|AutoHotkey}}==
AutoHotkey’s FileExist() function returns an attribute string (a subset of "RASHNDOCT") if a matching file or directory is found. The attribute string must be parsed for the letter D to determine whether the match is a directory or file.
<br><br>
<lang autohotkey>ShowFileExist("input.txt")▼
Another option is AutoHotkey's IfExist/IfNotExist command
<lang autohotkey>; FileExist() function examples
ShowFileExist("\input.txt")
ShowFolderExist("docs")
ShowFolderExist("\docs")
; IfExist/IfNotExist command examples (from documentation)
IfExist, D:\
MsgBox, The drive exists.
IfExist, D:\Docs\*.txt
MsgBox, At least one .txt file exists.
IfNotExist, C:\Temp\FlagFile.txt
MsgBox, The target file does not exist.
Return
ShowFileExist(file)
{
}
ShowFolderExist(folder)
{
}</lang>
|