Cormin Posted July 25, 2018 Posted July 25, 2018 (edited) I keep writing and deleting my code and I'm having a rough time getting something to work.. I cant for the life of me figure out how to move files from a sub folder into its parent folder. Preferably moving only one file type(*.bps) then deleting the old subfolder and all of its contents. I also want to ignore the folder named "finished" Here's my broken code that gets a stack overflow Func subfolders() $aFileList = _FileListToArray(@ScriptDir & "\Patches\", "*",2) if IsArray($aFileList) Then While $arraynumber < ($aFileList[0]+1) if StringInStr($aFileList[$arraynumber],"Finished",2) then $arraynumber = $arraynumber + 1 subfolders() Else DirMove(@ScriptDir & "\Patches\" & $aFileList[$arraynumber],@ScriptDir & "\Patches\") subfolders() EndIf WEnd EndIf endFunc $arraynumber = 1 subfolders() Edited July 25, 2018 by Cormin
Cormin Posted July 25, 2018 Author Posted July 25, 2018 Just thought I'd give this a bump as its been 16 hours with no reply and this post is on the middle of the 2nd page. Sorry
BrewManNH Posted July 25, 2018 Posted July 25, 2018 Maybe you can use something like this? #include <File.au3> Func subfolders() $aFileList = _FileListToArrayRec(@ScriptDir & "\Patches\", '*;"";Finished', $FLTAR_FILES , $FLTAR_RECUR ) If IsArray($aFileList) Then For $arraynumber = 1 To $aFileList[0] - 1 FileMove(@ScriptDir & "\Patches\" & $aFileList[$arraynumber], @ScriptDir & "\Patches\") Next EndIf EndFunc ;==>subfolders subfolders() Cormin 1 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 GudeHow 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
Cormin Posted July 25, 2018 Author Posted July 25, 2018 (edited) @BrewManNH This is great! Looks like it still moves files from the "Finished" subfolder though. I dont understand what you did there so I dont know how to fix it. Edited July 25, 2018 by Cormin
Moderators JLogan3o13 Posted July 25, 2018 Moderators Posted July 25, 2018 @Cormin when replying please just hit the Reply button rather than quoting what everyone says. We know what we said (we were there when we said it), and it pads the thread needlessly. Cormin 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Cormin Posted July 25, 2018 Author Posted July 25, 2018 (edited) Sorry I was just hoping to notify that specific user... I got it working, thanks again @BrewManNH I really appreciate it! Edited July 26, 2018 by Cormin
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now