Check that file exists: Difference between revisions

Content added Content deleted
(Add BaCon)
No edit summary
Line 843: Line 843:
'c:\input.txt' exists
'c:\input.txt' exists
'c:\docs' exists
'c:\docs' exists
</pre>

=={{header|Gambas}}==
<lang gambas>Public Sub Main()

If Exist(User.Home &/ "input.txt") Then Print "'input.txt' does exist in the Home folder"
If Not Exist("/input.txt") Then Print "'input.txt' does NOT exist in Root" 'Not messing With my Root files

If Exist(User.home &/ "docs/") Then Print "The folder '~/docs' does exist"
If Not Exist("/docs/") Then Print "The folder '/docs' does NOT exist" 'Not messing With my Root files

File.Save(User.Home &/ "`Abdu'l-Bahá.txt", "")
If Exist(User.Home &/ "`Abdu'l-Bahá.txt") Then Print "'`Abdu'l-Bahá.txt' does exist (zero length and unusual name)"

End</lang>
Output:
<pre>
'input.txt' does exist in the Home folder
'input.txt' does NOT exist in Root
The folder '~/docs' does exist
The folder '/docs' does NOT exist
'`Abdu'l-Bahá.txt' does exist (zero length and unusual name)
</pre>
</pre>