Jump to content

Recommended Posts

Posted

hi guys  i have this  scenario i have a folder  inside of them i have  3  folder i want erase the  first old folder , how  is possible do that ?

i create this script but sometime work and often dont work

Func _3FolderMaximum($Path)

    Local $FileList = _FileListToArray($Path, "*.*", 2)
    If @error = 1 Then
        MsgBox(0, "", "No Folders Found.")
        Exit
    EndIf
    If @error = 4 Then
        MsgBox(0, "", "No Files Found.")
        Exit
    EndIf
    _ArrayDisplay($FileList)


    If IsArray($FileList) Then
        If ($FileList[0]) = 3 Then

            Local $hSearch = FileFindFirstFile($Path & "\*.*")
            Local $sFileName = FileFindNextFile($hSearch)
            MsgBox(0, '', $sFileName)
            DirRemove($Path & "\" & $sFileName, 1)

        EndIf
    EndIf
FileClose($hSearch)
EndFunc   ;==>_3FolderMaximum

some one can help me??

thankz

 

Posted

Use _FileListToArrayRec to look at the folder and its sub-folders.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted (edited)

i dont think for my case  is  good  i dont  want  look  inside sub sub folder ,  i  want  controll   if exist in  a folder,.....     3  folder, if  yes  , i  must  erase  the  1 oldest  of  3  forlder

for me  a problem is not  sorting  folder or  file , but  compare  3  folder date 

 

Edited by faustf
Posted

big  questions  FileFindFirstFile    but  what  firstfile  find???    how  search  ???  by  alphabet or  by date  or  ??? o_O   i dont understund

 

Posted

i try to run  example  but i think not  work correctly i save the example in oter folder inside of them i have many file  the  first  start  with _A  but  when i run script  it  start of  B letter o_O

Posted

questions the  function  _Date_Time_CompareFileTime in example have this part o code

; Compare FAT Dates/Times
    $tFileTime1 = _Date_Time_DOSDateTimeToFileTime(0x3621, 0x11EF) ; 01/01/2007 02:15:30
    $tFileTime2 = _Date_Time_DOSDateTimeToFileTime(0x379F, 0x944A) ; 12/31/2007 18:34:20

how is  possible to convert a date in  0x3621, 0x11EF ???

thankz

 

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
×
×
  • Create New...