Sign in to follow this  
Followers 0
Gif

file extension

7 posts in this topic

is there any way to get the extension of a file?

like to know if it is .exe or .zip or even if there is not any extension (directory)

Share this post


Link to post
Share on other sites



...or even if there is not any extension (directory)

Not having an extension is NOT a good test for a directory!

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Not having an extension is NOT a good test for a directory!

:)

not having an extension means its a directory , however the "problem" is solved

Share this post


Link to post
Share on other sites

not having an extension means its a directory , however the "problem" is solved

I think what PsaltyDS means is that a directory CAN have an extension. For instance, I have several directories on my drive that have been renamed to something with a descriptive extension: like if I want to compare a fresh program installation to an corrupted one, I'll rename the original from something like

C:\Program Files\myProgram

to

C:\Program Files\myProgram.old

and thus my directory now has an extension. So any code that differentiated between files and directories merely on the basis of whether there was an extension or not would think "myProgram.old" was a file but it's not.

Share this post


Link to post
Share on other sites

I think what PsaltyDS means is that a directory CAN have an extension.

My point exactly, AND that a file might not have extension, yet not become a directory. Run this:

$TopDir = @TempDir & "\Extension Demo"
Dim $avDirs[2] = ["\DirNoExt", "\DirWithExt.txt"]
Dim $avFiles[2] = ["\FileNoExt", "\FileWithExt.txt"]
For $d = 0 To 1
    DirCreate($TopDir & $avDirs[$d])
    For $f = 0 To 1
        FileWriteLine($TopDir & $avDirs[$d] & $avFiles[$f], @HOUR & ":" & @MIN & ":" & @SEC)
    Next
Next
ShellExecute('explorer', '"' & $TopDir & '"')

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0