nico666 Posted November 11, 2006 Share Posted November 11, 2006 Hello everybody, I'm searching for something for get the file dir... I found FilegetFullName but I don't want the name of the file with only the dir. How can I do that? Bye Link to comment Share on other sites More sharing options...
Developers Jos Posted November 11, 2006 Developers Share Posted November 11, 2006 Hello everybody, I'm searching for something for get the file dir... I found FilegetFullName but I don't want the name of the file with only the dir.How can I do that? Bye_PathSplit() ? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
mads3n Posted November 11, 2006 Share Posted November 11, 2006 Dim $szDrive, $szDir, $szFName, $szExt $TestPath = _PathSplit(@ScriptFullPath, $szDrive, $szDir, $szFName, $szExt) Its the $szDir you need i think Mads3n.dk Link to comment Share on other sites More sharing options...
nico666 Posted November 11, 2006 Author Share Posted November 11, 2006 hmmm I have this script: expandcollapse popup#Include<file.au3> #include <array.au3> $aArray = _ParseAndFind(@UserProfileDir&'\', 'test.txt') Func _ParseAndFind($hDirectory, $hFindFile, $iDelete = 0, $iPrompt = 0, $iOverRide = 0) RunWait(@Comspec & ' /c dir /b /s /a "' & $hDirectory & '" > "' & _ @TempDir & '\RecursivOutput.txt"', @WorkingDir, @SW_HIDE) If Not FileExists(@TempDir & '\RecursivOutput.txt') Then Return SetError(1, 0, 0) Local $hFoundFiles = FileRead(@TempDir & '\RecursivOutput.txt') FileDelete(@TempDir & '\RecursivOutput.txt') If Not $hFoundFiles Then Return SetError(2, 0, 0) Local $sHold = '', $aSplit = StringSplit(StringStripCR($hFoundFiles), @LF) For $iCC = 1 To UBound($aSplit) - 1 If StringTrimLeft($aSplit[$iCC], StringInStr($aSplit[$iCC], '\', 0, -1)) = $hFindFile Then If $iPrompt And $iDelete Then If MsgBox(36, 'Delete?', 'Would you like to delete:' & @CR & $aSplit[$iCC]) = 6 Then If Not FileDelete($aSplit[$iCC]) And $iOverRide And StringInStr(FileGetAttrib($aSplit[$iCC]), 'R') Then FileSetAttrib($aSplit[$iCC], '-R') If FileDelete($aSplit[$iCC]) Then $sHold &= $aSplit[$iCC] & @LF Else $sHold &= $aSplit[$iCC] & @LF EndIf EndIf ElseIf $iDelete Then If Not FileDelete($aSplit[$iCC]) And $iOverRide And StringInStr(FileGetAttrib($aSplit[$iCC]), 'R') Then FileSetAttrib($aSplit[$iCC], '-R') If FileDelete($aSplit[$iCC]) Then $sHold &= $aSplit[$iCC] & @LF Else $sHold &= $aSplit[$iCC] & @LF EndIf Else $sHold &= $aSplit[$iCC] & @LF EndIf EndIf Next If $sHold Then Return StringSplit(StringTrimRight($sHold, 1), @LF) Return SetError(3, 0, 0) EndFunc So the File is $aaray[1] but How can I get the dir of this file? can you do it with the _pathsplit? I don't know ohw to use it Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 11, 2006 Moderators Share Posted November 11, 2006 I remember writing that... Sure you can get the directory of it. Just use the $aArray[n] as the string in _PathSplit(). Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
nico666 Posted November 12, 2006 Author Share Posted November 12, 2006 I found how to do Dim $szDrive, $szDir, $szFile, $stExt $reetarray = _PathSplit($aArray[1],$szDrive,$szDir,$szFile,$stExt) $path = $szDrive & $szDir thanks Link to comment Share on other sites More sharing options...
tittoproject Posted November 12, 2006 Share Posted November 12, 2006 (edited) Well, if you need only the path... Func _FileGetDir($fPath) Return StringLeft($fPath, StringInStr($fPath, '\', 0, -1) - 1) EndFunc it should work Edited November 12, 2006 by tittoproject 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