[Scripting help] move selected files to folder due to name
Posted: 29 Oct 2015 11:27
i have a folder that contains file like this
AYANE_COS_001.bmp
christie_COS_001.bmp
helena_COS_001.bmp
i want to write a script do this with the selected files :
get the string right before "_" character (without quotes) in filename and set it to the target folder i want to move files to (and suffix rename if there is duplicate file name)
for example
(and suffix rename if there is duplicate file name)
i can get the target foldername by regexreplace "selecteditemsnames"
$targetfolder = regexreplace($selecteditemsnames,"_.*","")
but i have no idea how to do next ,i have no succeed with "foreach" yet
i can do this with autohotkey ,but if i move files with autohotkey ,the comments and tags of files will be lost
Any help would be really appreciated
thanks alot
AYANE_COS_001.bmp
christie_COS_001.bmp
helena_COS_001.bmp
i want to write a script do this with the selected files :
get the string right before "_" character (without quotes) in filename and set it to the target folder i want to move files to (and suffix rename if there is duplicate file name)
for example
(that means "string_blablabla.bmp" will be move to "E:\copydir\string" )"AYANE_COS_001.bmp" will be move to "E:\copydir\AYANE\"
"christie_COS_001.bmp" will be move to "E:\copydir\christie\"
"helena_COS_001.bmp" will be move to "E:\copydir\helena\"
(and suffix rename if there is duplicate file name)
i can get the target foldername by regexreplace "selecteditemsnames"
$targetfolder = regexreplace($selecteditemsnames,"_.*","")
but i have no idea how to do next ,i have no succeed with "foreach" yet
i can do this with autohotkey ,but if i move files with autohotkey ,the comments and tags of files will be lost
Any help would be really appreciated
thanks alot