Buffo Posted November 19, 2005 Share Posted November 19, 2005 Hi My script receives a paramter (path to file or folder) per commandline. I have to check whether it's a file or folder. How I can realize this? Regards, T-Bone-Rex Link to comment Share on other sites More sharing options...
t0ddie Posted November 19, 2005 Share Posted November 19, 2005 search for "." with stringinstr. all files have an extention. folders dont. this will not work of course if the folder name has "." in it, but most extentions are also 3 characters so you could add some logic for that. you can get pretty specific with minimal problems with this method. Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
Zedna Posted November 19, 2005 Share Posted November 19, 2005 Use FileGetAttrib ( "filename" )R" = READONLY"A" = ARCHIVE"S" = SYSTEM"H" = HIDDEN"N" = NORMAL"D" = DIRECTORY"O" = OFFLINE"C" = COMPRESSED (NTFS compression, not ZIP compression)"T" = TEMPORARYLook at HelpFile... Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Valik Posted November 19, 2005 Share Posted November 19, 2005 with stringinstr. all files have an extention. folders dont.Wrong on both counts. "C:\Path\To\File" is a perfectly valid file name and "C:\Path\To\Directory.Suffix" is a perfectly valid directory name. Link to comment Share on other sites More sharing options...
ChrisL Posted November 19, 2005 Share Posted November 19, 2005 func isFolder($path) if stringInStr(fileGetAttrib($path), "D") then return 1 return 0 endFunc [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now