04-03-2012, 03:22 PM
Macro Macro1706
str files="d:\downloads\*.doc" ;;change this
str moveToFolder="c:\folder" ;;change this
mkdir moveToFolder ;;create folder if does not exist
Dir d
foreach(d files FE_Dir) ;;for each file that matches the pattern. The initial code created with dialog "Enumerate files".
,str sPath=d.FileName(1)
,;out sPath ;;debug
,str newFolder.from(moveToFolder "\" _s.getfilename(sPath)) ;;create new folder path
,;out newFolder; continue ;;debug
,mkdir newFolder ;;create new folder for the file
,ren sPath newFolder ;;move the file
run moveToFolder ;;open the destination folder to see what we have