Hello,
would like to automatically have certain file extensions (example: jpg) moved from a certain folder to another folder. As soon as the file with that extension in Folder A (with extension jpg) to be moved to Folder B
Automatically Move files with specific extensions.
Re: Automatically Move files with specific extensions.
Code: Select all
#Persistent
srcPath := "C:\myImages"
destPath := "D:\myImages\mysubFolder"
SetTimer, TheMover, % 1*60*1000 ; check once every minute
Return
TheMover:
Loop, Files,% srcPath "\*.jpg"
FileMove,% A_LoopFileFullPath,% destPath
Return
Re: Automatically Move files with specific extensions.
That should work fine. A couple of suggestions if I may:
You could use WatchFolder() to trigger the subroutine only (and without delay) when there is a change to the folder.
The subroutine doesn’t need the if part because if there are no .jpg files, the loop will execute zero times, so it functions as a built-in conditional as well:
You could use WatchFolder() to trigger the subroutine only (and without delay) when there is a change to the folder.
The subroutine doesn’t need the if part because if there are no .jpg files, the loop will execute zero times, so it functions as a built-in conditional as well:
Code: Select all
TheMover:
Loop, Files,% srcPath "\*.jpg"
FileMove,% A_LoopFileFullPath,% destPath
ReturnRe: Automatically Move files with specific extensions.
WatchFolder: awesome!
Re: Automatically Move files with specific extensions.
because if there are no .jpg files, the loop will execute zero times, so it functions as a built-in conditional as wel
Who is online
Users browsing this forum: Bing [Bot], lyscop and 60 guests