Jump to content

FileGetAttrib not working, need help, been debugging for While please WEnd


Go to solution Solved by ioa747,

Recommended Posts

Posted (edited)

here's the code i'm working on. it outputs to clipboard the directory contents.

cant get no output from Local $cdir = FileGetAttrib($fname) ;----dosnt work

nothing relaying on this code works downstream, leaving me with non-trailing \ on the directorys

am i missing something here?

#NoTrayIcon

If $CmdLine[0] = 0 Then Exit

Local $isfile = ""

Local $fsearch = FileFindFirstFile($CmdLine[1] & "\*")
If $fsearch = -1 Then Exit

While 1
        Local $fname = FileFindNextFile($fsearch)
        If @error Then ExitLoop
        Local $cdir = FileGetAttrib($fname) ;----dosnt work
        ConsoleWrite($cdir & @CRLF)
    Select
        Case StringInStr($cdir,"D")
        $isfile = $isfile & $CmdLine[1] & "\" & $fname & "\" & @CRLF
        Case Else
        $isfile = $isfile & $CmdLine[1] & "\" & $fname & @CRLF
    EndSelect
WEnd

ClipPut(StringTrimRight($isfile,2))
Beep(500,200)

Exit

 

Edited by Jos
added codebox... please use <> next time.
  • Solution
Posted (edited)

Edit:
FileGetAttrib nedd full path not only the file name

check the flag  parameter on  FileFindNextFile ( search [, flag = 0])

#NoTrayIcon

If $CmdLine[0] = 0 Then Exit

Local $isfile = ""

Local $fsearch = FileFindFirstFile($CmdLine[1] & "\*")
If $fsearch = -1 Then Exit

While 1
    Local $fname = FileFindNextFile($fsearch)
    If @error Then ExitLoop

    If @extended = 1 Then
        $isfile &= $CmdLine[1] & "\" & $fname & "\" & @CRLF
        ConsoleWrite("- Dir:" & $fname & @CRLF)
    Else
        ConsoleWrite(" file:" & $fname & @CRLF)
        $isfile &= $CmdLine[1] & "\" & $fname & @CRLF
    EndIf
WEnd

ClipPut(StringTrimRight($isfile, 2))
Beep(500, 200)

 

Edited by ioa747

I know that I know nothing

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
  • Recently Browsing   0 members

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