Page 1 of 1

transfer files to another folder based on file extension

Posted: 19 Sep 2019, 21:25
by reverberation
Requirements as follows:

1. Actively monitor folder for "jpg" extension (without using loop command, so that it doesn't always tax the system. I only want it to trigger when there are new files in the Download Folder)
2. When jpg detected, CUT and paste it to a different folder (e.g. C:/Photos)

Has anyone done this before? Any sample script will be most appreciated, thanks!

Re: transfer files to another folder based on file extension

Posted: 19 Sep 2019, 23:57
by Xtra
https://www.autohotkey.com/boards/viewtopic.php?f=6&t=8384&hilit=watchfolder

When it detects a change run a Filemove routine using a filepattern for the source location.

Re: transfer files to another folder based on file extension

Posted: 20 Sep 2019, 19:26
by reverberation
Hi, will you be so nice as to post a sample script please? I am not sure how to run the routine while checking the file extension..

Re: transfer files to another folder based on file extension

Posted: 20 Sep 2019, 20:35
by Xtra
Download:
WatchFolder.ahk
WatchFolder_sample.ahk

In the sample script add:
FileMove, % A_ScriptDir . "\*.jpg", % A_ScriptDir . "\MoveToFolder"
To the bottom of the MyUserFunc() function
(Change FileMove Source folder and Path to a folder of your choice)
(Change FileMove Destination folder and Path to a folder of your choice)

Run the sample script and select the folder to watch
Click Start button and start putting .jpg's in the watched folder.

You can edit sample script down from there if you do not want the GUI with listview.