Sign in to follow this  
Followers 0
Belini

List files and folders with long addresses.

4 posts in this topic

#1 ·  Posted (edited)

List files that exceed the limit supported by Windows.

; =============================================================
; Autoit3 3.3.9.2
; Autor: Belini
; Data: 11/10/2012
; Objetivo: Listar pastas e arquivos com endereço muito extenso
; =============================================================

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Global $caminho, $limite = 255, $numera = 0, $listar

If FileExists(@ScriptDir & "Caminho longo.ini") Then FileDelete(@ScriptDir & "Caminho longo.ini")

GUICreate("Listar arquivos com nome extenso.", 352, 132, 192, 114)
GUICtrlCreateLabel("Listar arquivos como número de caractéres maior ou igual a:", 8, 58, 287, 17)
Local $Input_caminho = GUICtrlCreateInput(@ScriptDir, 8, 16, 259, 21)
Local $Input_limite = GUICtrlCreateInput($limite, 296, 56, 49, 21)
Local $Button_proc = GUICtrlCreateButton("Procurar", 269, 14, 75, 25)
Local $Button_iniciar = GUICtrlCreateButton("Iniciar Listagem", 88, 96, 163, 25)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Button_proc
            $caminho = FileSelectFolder("Procurando pasta.", "", "", @ScriptDir)
            GUICtrlSetData($Input_caminho, $caminho)
        Case $Button_iniciar
            $caminho = GUICtrlRead($Input_caminho)
            $limite = GUICtrlRead($Input_limite)
            If Not FileExists($caminho) Then MsgBox(4096, "ERRO", "O caminho a ser pesquisado não existe.", 3)
            If $limite <= 0 Then MsgBox(4096, "ERRO", "Digite um limite de caractéres para iniciar a listagem.", 3)
            SplashTextOn("Lista:", "Listando arquivos, aguarde...", 280, 40, -1, -1, 33, "Arial black", 12)
            If FileExists($caminho) And $limite > 0 Then listar_cam_longo($listar, $caminho)
            MsgBox(4096, "Finalizado:", "Foram listados " & $numera & " arquivos com mais de " & $limite & " Caractéres.")
            SplashOff()
            exit
    EndSwitch
WEnd

Func listar_cam_longo(ByRef $listar, $path = "")
    $counter = 0
    $path &= ''
    Local $list_files = '', $file, $demand_file = FileFindFirstFile($path & '*')
    If $demand_file = -1 Then Return ''
    While 1
        $file = FileFindNextFile($demand_file)
        If @error Then ExitLoop
        If @extended Then
            If $counter >= 10 Then ContinueLoop
            listar_cam_longo($listar, $path & $file)
        Else
            If StringLen($path & $file) > $limite Then
                $numera += 1
                TrayTip("Listando", $file, 1, 0)
                IniWrite(@ScriptDir & "Caminho longo.ini", "CAMINHO EXTENSO", $path & $file, StringLen($path & $file) & " linhas")
            EndIf
        EndIf
    WEnd
    FileClose($demand_file)
EndFunc   ;==>listar_cam_longo
Edited by Belini

Share this post


Link to post
Share on other sites

My friend, you hardly have replicas in posts with scripts in Portuguese, so here is a fact: the forum is in English language!!!

In any case, nice script... :)

JS


http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

Hi

Not tried yet, but definitely a good one, at least for me

Thank you

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