A problem about moving files Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
songdg
Posts: 115
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: 3326
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: 115
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”

Who is online

Users browsing this forum: badda, capriccio, Epialis, frankr, jimhoyle, nathan323 and 66 guests