Jump to content

FileGetdir ?


nico666
 Share

Recommended Posts

  • Developers

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 :whistle: 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

hmmm I have this script:

#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 :whistle:

Link to comment
Share on other sites

  • Moderators

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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...