0

I am trying to create a script that runs an another script and changes the name from the output.

Here is the script so far:

#! /bin/bash

i=1

for N in mediainput.iso mediainput2.iso
do
    x264transcode $N
    mv $N $((i++))
done

This don`t that well. It just moves the files and renames them.

I need to first run the x264transcode and then rename the output of that. Since they all get the same name when x264transcode as processed the files.

Its okey that the name the files are changed to are 1 then 2 and so on.

But it would be a plus if there where a method of getting the name of the folder the file was inside or the file itself. Maybe choosing between them for different scenarios.

Example below:

  1. ~/Videos/Summer Vacation 2009/dvd.iso
  2. Output from x264: VIDEO01.mkv
  3. Output from rename script: Summer-Vacation-2009.mkv
1
  • This does not sound plausible for me. ` for N in mediainput.iso mediainput2.iso` sets the name of N to mediainput.iso, then to mediainput2.iso. Then you call x264transcode $N so this will bex264transcode mediainput.iso after the first variable substitution. mv $N $((i++)) will then mv/rename the input file. Is your inputfilename the output filename? But then, it isn't the same name for every file. You too are talking about folders. But mediainput.iso doesn't look as a foldername either. Am I getting something wrong? Commented May 1, 2012 at 20:15

1 Answer 1

1

Does x264transcode always call its output VIDEO01.mkv? Are all the video files dvd.iso? If so, something like this, to also get the correct filename with hyphens:

cd ~/Videos
for I in */dvd.iso
do
  x264transcode $I
  mv VIDEO01.mkv `dirname $I|tr ' ' -`.mkv
end

This is assuming x264transcode stores VIDEO01.mkv in the current directory rather than the directory its input file is located in.

Sign up to request clarification or add additional context in comments.

1 Comment

The video files will always be .iso or .img | The output is dynamic but always ends with .mkv | x264transcode stores the output in an different folder that I can specify.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.