Move files based on date/time created

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Nosyarg
Posts: 23
Joined: 16 Oct 2018, 16:23

Move files based on date/time created

16 Oct 2018, 16:39

Greetings.... and I ask forgiveness if this question has been posed before.... I have looked but not found all the answers I'm seeking.

Basically, I've got a video recording program that generates rather large files. I need to move those files to an external share, but I also need to categorize them by day and group them by hour. I could be generating upwards of 100 files per day, but they'll all have unique filenames, so that's not an issue. I just need a macro set up to act as a watch folder to take the file, determine it's destination directory by the day and time the file was created, and ship the file there.

Another question I have... if I schedule the watcher to start every 10 minutes or so, will it act upon files that are only partially created? These recordings will be somewhat large.

So if I start a recording at 4:30am that runs for 10 minutes... then I start another one 2 minutes later that runs for 7 minutes, then another one 2 minutes or so after that which runs for 12 minutes, can I start a watcher that runs often but only enacts on complete files?

This is becoming a beast of a project as I think about it. Any help or suggestions in putting this together would be welcomed with open arms. Thanks!
truekefir
Posts: 17
Joined: 29 Jul 2017, 13:57

Re: Move files based on date/time created

16 Oct 2018, 20:14

FileMove wouldn't move a file if it's being locked by recording software, so there is no problem with that.
User avatar
AlphaBravo
Posts: 586
Joined: 29 Sep 2013, 22:59

Re: Move files based on date/time created

16 Oct 2018, 20:58

here is something to fiddle with

Code: Select all

SrcFolder := A_Desktop
DestFolder := "c:\"
SetTimer, Timer, 10000												; 10 second timer
return

Timer:
Loop, Files, % SrcFolder "\*.avi"											; assuming avi files type
{
	file := A_LoopFileFullPath											; save file full path	
	SubFolder := DestFolder "\" SubStr(A_LoopFileTimeModified, 5,6)			; subfolder named after month day and hour mmddhh
	if !InStr(FileExist(SubFolder), "D")									; if folder does not exist
		FileCreateDir, % SubFolder										; create folder
	FileMove, % file , % SubFolder "\" *.*									; move file to destination
}
Nosyarg
Posts: 23
Joined: 16 Oct 2018, 16:23

Re: Move files based on date/time created

07 Feb 2019, 09:00

truekefir wrote:
16 Oct 2018, 20:14
FileMove wouldn't move a file if it's being locked by recording software, so there is no problem with that.
Excellent! Thanks!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: doanmvu, Google [Bot], jomaweb, mikeyww and 227 guests