Some downloads add a subfolder then the VIDEO_TS folder
ex: P:\Movies\moviename\unwantedmoviefolder\VIDEO_TS
Is there a way in windows to check if this unwanted folder is in the %1 directory and move the VIDEO_TS folder to the %1 directory and delete the unwanted folder?
windows script to move VIDEO_TS to proper folder
-
- Release Testers
- Posts: 180
- Joined: February 20th, 2008, 3:16 pm
Re: windows script to move VIDEO_TS to proper folder
if you run this as part of your postprocessing it should do what you want
Code: Select all
set dirname=%1
set dirname=%dirname:"=%
set name=%3
set name=%name:"=%
set nbID=%4
set DLTYPE=%5
for /D /R "%dirname%" %%f in (VIDEO_TS*) do move "%%f" "%dirname%\"
Re: windows script to move VIDEO_TS to proper folder
Thanks. That worked. But I can't seem to delete the old directory
This is my output:
So, I tried to add the following to remove the "somefolder", but I cant' seem to get it set correctly.
and here is the output (%oldfolder is not getting set properly)
Can anyone help me with this?
This is my output:
Code: Select all
Q:\Movies\movietest>set dirname=
Q:\Movies\movietest>set dirname="=
Q:\Movies\movietest>set dirname=Q:\Movies\movietest
Q:\Movies\movietest>set name=
Q:\Movies\movietest>set name="=
Q:\Movies\movietest>set nbID=
Q:\Movies\movietest>set DLTYPE=
Q:\Movies\movietest>for / %f in (VIDEO_TS*) do move "%f" "Q:\Movies\movietest\"
Q:\Movies\movietest>move "Q:\Movies\movietest\somefolder\VIDEO_TS" "Q:\Movies\movietest\"
Code: Select all
set oldfolder=%%f
set oldfolder=%oldfolder:VIDEO_TS=%
echo old folder is %oldfolder%
Code: Select all
set oldfolder=Q:\Movies\movietest\somefolder\VIDEO_TS
set oldfolder==
echo old folder is =
-
- Release Testers
- Posts: 180
- Joined: February 20th, 2008, 3:16 pm
Re: windows script to move VIDEO_TS to proper folder
the %%f variable is only addressable on the "for" line. If you want to do something more than 1 line's worth I would suggest you call a subroutine. like this
code untested! it may have typos
Code: Select all
set dirname=%1
set dirname=%dirname:"=%
set name=%3
set name=%name:"=%
set nbID=%4
set DLTYPE=%5
for /D /R "%dirname%" %%f in (VIDEO_TS*) do CALL :moveVTS "%%f"
GOTO :EOF
:moveVTS
REM note %%f is now %1 in the context of this subroutine and is surrounded by ""
move %1 "%dirname%\"
REM more commands here
GOTO :EOF