Jump to content

moving contents of folder


smstroble
 Share

Recommended Posts

Ok i must be missing something here. :P im trying to move the contents of a folder but not the folder its self. Filemove("sourcefoler\*", "destnationfolder", 1) works greak for the files but i cant figure a way to move the folders in the folder, using DirMove which moved the source folder which i dont want to do. is there anyway to search for the subdirectorys within a directory?

thanks for your help :)

Edited by smstroble

MUHAHAHAHAHA

Link to comment
Share on other sites

#include <file.au3>
Func _MoveFilesAndDirectories($srcFolder, $srcDest)
    Local $avFilesArray = _FileListToArray($srcFolder)
    For $i = 1 to $avFilesArray[0]
        if (FileGetSize($avFilesArray[$i]) <= 0) Then ;Checks if its a folder or a file.
            DirCopy($srcFolder & "\" & $avFilesArray[$i], $srcDest & "\" & $avFilesArray[$i] & "\")
        Else
            FileCopy($srcFolder & "\" & $avFilesArray[$i], $srcDest & "\" & $avFilesArray[$i])
        EndIf
    Next
EndFunc
    
_MoveFilesAndDirectories("Glib", "test")

hmm, this seems to work for me :)

Thats what you're looking for right?

Edited by CHRIS95219
Link to comment
Share on other sites

hmm dident work quite right..

so i fixed it! :)

Func _MoveFilesAndDirectories($srcFolder, $srcDest)
    Local $avFilesArray = _FileListToArray($srcFolder)
    For $i = 1 To $avFilesArray[0]
        if (FileGetSize($srcFolder & "\" & $avFilesArray[$i]) <= 0) Then ;Checks if its a folder or a file.
            DirMove($srcFolder & "\" & $avFilesArray[$i], $srcDest & "\" & $avFilesArray[$i])
        Else
            FileMove($srcFolder & "\" & $avFilesArray[$i], $srcDest & "\", 8)
        EndIf
    Next
EndFunc

edit: minor code simplification

Edited by smstroble

MUHAHAHAHAHA

Link to comment
Share on other sites

FileCopy($avFilesArray[$i]
very strange indeed you dident close the () for the filecopy function

anyway np thanks much for the help :P

incase your wondering what im working on im makeing a "real" desktop switcher. real meaning it will have unique desktop icons/items for each virtual desktop. only been able to find one other program like it and its $25 :)

MUHAHAHAHAHA

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...