I have a video file conversion script that scans an input folder and subs, converts and sends them to an output folder and subs. The subfolders have to have the same names (used as 'channels' in a media extender box application). Im getting lost though. I dont think this will parse across drive letters. (although its working on the same drive for in/out).
Code:
{
Loop %InPath%\*.*,0,1
If A_LoopfileExt in %Ext%
{
Opdid1=""
Opdid2=""
Splitpath, A_Loopfilefullpath,,Filedir,,FilenameNoExt,
RegExMatch(FileDir,"^.*\\(?=[^\\]+\\?$)",Rootpath)
StringReplace, Foldername, Filedir, %Rootpath%,, ; now Foldername is the folder name only
If Filedir contains Incomplete Downloads ; incomplete downloads is the name of the currently downloading folder
Continue ; dumps this file and goes onto the next
FileGetSize, ThisFileSize,, K ; gets filesize for the current file
If Thisfilesize = 0 ; if it has blank filesize
Continue ; dump and get next file
IfExist, %OutPath%\%Foldername%\%FilenameNoExt%.mpeg ; if its already been converted, then dump
Continue ;
FileCreateDir, %OutPath%\%Foldername%
Runwait, ffmpeg.exe -i %A_Loopfilefullpath% %FFopt% %OutPath%\%Foldername%\%FilenameNoExt%.mpeg ,,%FFShow%
If Errorlevel > 0
{
FileAppend, FFMpeg Error`n, %A_Scriptdir%\mpegmaker4miro.log
Msgbox, FFMpeg Error !
GoSub, Quitter
}
etc.. just the applicable snippet here
This wont parse across drives will it ? Masking FileDir and RootPath gives me the name of the folder.. but only when its the same drive ?
I got the regex from a post on here, its probably not what I need but Im still a weakling with regex. Is there a way to get just the folder name in regex ?
Thx for any help
edit: I guess it would help to point out that InPath and OutPath are vars set in an ini file.. for example Inpath = e:\download\miro and Outpath = e:\download\videos. But of course, a user could put any In or Out path in there.. depending on their setup. So, a source file might be e:\download\miro\folderA\rssvideo.mp4 and the corresponding output should be e:\download\videos\folderA\rssvideo.mpeg
The stringreplace line would fail if the input was e:\downloads\miro\folderA\rssvideo.mp4 and the output was f:\myvideos\folderA\rssvideo.mpeg (at least I think the mask would fail..)