mydxbtester
Thread Starter
- Joined
- Apr 21, 2015
- Messages
- 9
I have a difficulty in matching strings from filename. Say, I have this recording files as follow:
a. [FONT="]2015-04-13-14-45-47_XXXXXXXXXXXX_20010.mp4
[/FONT]b. [FONT="]2015-04-13-15-46-48_[/FONT][FONT="][FONT="]YYYYYYYYYYYY_[/FONT]20015.mp4[/FONT]
c. [FONT="][FONT="]2015-04-13-16-47-49_20016_AAAAAAAAA.mp4[/FONT]
[/FONT]
20010, 20015, and 20016 are IP Phone Extensions
[FONT="]XXXXXXXXXXXX[/FONT] and [FONT="]YYYYYYYYYYYY [/FONT]are specific phone numbers
[FONT="][FONT="]AAAAAAAAA [/FONT][/FONT]is a random called number
What I wanted is for all recordings to be place to specific folder, everytime [FONT="]XXXXXXXXXXXX or [/FONT][FONT="]YYYYYYYYYYYY [/FONT]calls an IP Phone Extension - the recording should be placed to a folder named "Specific". So, items "a" and "b" will be moved to "Specific" folder while item "c" will be moved to folder 20016.
Here's what I did so far but it does not work:
What could I be missing here.
a. [FONT="]2015-04-13-14-45-47_XXXXXXXXXXXX_20010.mp4
[/FONT]b. [FONT="]2015-04-13-15-46-48_[/FONT][FONT="][FONT="]YYYYYYYYYYYY_[/FONT]20015.mp4[/FONT]
c. [FONT="][FONT="]2015-04-13-16-47-49_20016_AAAAAAAAA.mp4[/FONT]
[/FONT]
20010, 20015, and 20016 are IP Phone Extensions
[FONT="]XXXXXXXXXXXX[/FONT] and [FONT="]YYYYYYYYYYYY [/FONT]are specific phone numbers
[FONT="][FONT="]AAAAAAAAA [/FONT][/FONT]is a random called number
What I wanted is for all recordings to be place to specific folder, everytime [FONT="]XXXXXXXXXXXX or [/FONT][FONT="]YYYYYYYYYYYY [/FONT]calls an IP Phone Extension - the recording should be placed to a folder named "Specific". So, items "a" and "b" will be moved to "Specific" folder while item "c" will be moved to folder 20016.
Here's what I did so far but it does not work:
Code:
set extensions=/20010/20015/20020/20025/XXXXXXXXXXXX/YYYYYYYYYYY/
for %%a in ("%FolderIncoming%\%FileMask%") do (
set FileName=%%~na
for %%b in (!Filename:_^= !) do (
if "!extensions:/%%b/=!" neq "%extensions%" set "extension=%%b"
)
REM set TargetYear=!FileName:~0,4!
set TargetFolder=!extension!\!FileName:~0,10!
if %extension% == "XXXXXXXXXXXX" (
REM Save file to "Specific" folder since it contains "XXXXXXXXXXXX"
) else (
if %extension% == "YYYYYYYYYYY" (
REM Save file to "Specific" folder since it contains "YYYYYYYYYYY"
)
) else (
if not exist "%FolderSorted%\!TargetFolder!\%%~na.mp3" (
echo Processing '!FileName!' ...
REM Save file to source IP phone extension
))