Jump to content

Sum help with arrays.


Recommended Posts

Ok. What i'm trying to do...

7 folders (only folders)... in 6 folders there is files stored and in 1 folder there is folders. (in my ocassion) (in could be N folders with files and N folders with folders)

i need to copy all files from all the folders to folder and also copy the folders from the folders folder to the new folder (messy huh?)

all the filenames and the folders in the folder folder has something in thery name that i dont want

Map:

Is:

Folder ($DIR) \Folder1\File1

Folder\Folder2\File2

Folder\Folder3\SomeFolder1

Folder\FolderN\FileQ

Folder\FolderY\SomeAmmountOfFoldersZ

needs to be

Folder($OldDir)\File1

Folder\File2

Folder\SomeFolder1

Folder\FileQ

Folder\SomeAmmountOfFoldersZ

$Dir = current dir

$OldDir = the dir that the files will be moved to

$Inside = List of dirs that are in the $Dir

$CurrentDir = takes everydir name from the array

$CurrentDir = path to dir list + dirname

$InsideThe = Inside the $CurrentDir (could be only folders)

if count of folders = 0 the remaking the array with both files and folders (there will be only files but who cares)

then for everyfile in the folder move to the $OldDir

then again we list all the folders in the folder. if ammount of folders > 0 then move the folders to $OldDir...

NEXT folder in $Dir

#Include <File.au3>
#Include <Array.au3>
#Include <Date.au3>
$OldDir = "C:\Audriaus\DC++\Finished\"
$Dir = "C:\Audriaus\DC++\Organized\"
$Inside = _FileListToArray($Dir,"*",2)
;DO I NEED THIS ? $array[0] = filecount 
;$Inside = _ArrayDelete($Inside,0)
For $CurrentDir In $Inside
        $CurrentDir = $Dir & $CurrentDir
        $InsideThe = _FileListToArray($CurrentDir,2)
              ;DO I NEED THIS?
;$InsideThe = _ArrayDelete($InsideThe, )

        If $InsideThe[0] = 0 Then
            $InsideThe = _FileListToArray($CurrentDir)
            For $File In $InsideThe
                FileMove($CurrentDir & "\" & $file, $OldDir & StringMid($File,StringInStr($File, "#", 0, -1),9)
            NEXT
        EndIf
        $InsideThe = _FileListToArray($CurrentDir,2)
        If $InsideThe[0] > 0 Then
            $InsideThe = _FileListToArray($CurrentDir,2)
            For $File In $InsideThe
                DirMove($CurrentDir & "\" & $file, $OldDir & StringMid($File,StringInStr($File, "#", 0, -1))
            NEXT
        EndIf
    
NEXT

Hope someone understood and can help me. You can make the script do the same thing in an other way if you want.

Edited by Jammer
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...