A problem about moving files Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
songdg
Posts: 568
Joined: 04 Oct 2017, 20:04

A problem about moving files

07 Jul 2020, 21:14

Here is an example from the help document, I want to add a folder under "C:\", and move each file to the new folder in the loop.

Code: Select all

FileList := ""  ; Initialize to be blank.
Loop, C:\*.*
    FileList .= A_LoopFileName "`n"
Sort, FileList, R  ; The R option sorts in reverse order. See Sort for other options.
Loop, parse, FileList, `n
{
    if (A_LoopField = "")  ; Ignore the blank item at the end of the list.
        continue
    MsgBox, 4,, File number %A_Index% is %A_LoopField%.  Continue?
    IfMsgBox, No
        break
}
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: A problem about moving files  Topic is solved

08 Jul 2020, 01:08

Loop, C:\*.*
TBH, I doubt that you'll find this kinda Loop at the AHK help. Prove me wrong :)

Code: Select all

destinationpath := "C:\myfolder\mysubfolder"
.
.
.
Loop, Parse ...
    FileMove,% "C:\" A_LoopField,% destinationpath "\" A_LoopField
songdg
Posts: 568
Joined: 04 Oct 2017, 20:04

Re: A problem about moving files

11 Jul 2020, 02:07

BoBo wrote:
08 Jul 2020, 01:08
Loop, C:\*.*
TBH, I doubt that you'll find this kinda Loop at the AHK help. Prove me wrong :)

Code: Select all

destinationpath := "C:\myfolder\mysubfolder"
.
.
.
Loop, Parse ...
    FileMove,% "C:\" A_LoopField,% destinationpath "\" A_LoopField
Thank you very much.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: filipemb, Google [Bot], Ineedhelplz, Spawnova and 337 guests