Translating Windows script for use in Linux
I have this batchfile that I use in Windows that I would like to translate into a Linux script. Could anyone help with that? Here is the script and the attempt at a Linux version. I did not write this, someone helped me.
The purpose is to run a python command "manual.py" which converts any file that is not an MP4 into an MP4 with FFmpeg. I have it running as a scheduled task in Windows against a mapped Linux share; however, I would rather just have the script run on the Linux box.
My Linux scripting skills are, well, non-existent.
This works
@echo off
setlocal enableDelayedExpansion
Set Location="z:movies"
Set PatternName=".*.mp4 .*srt"
Set Transcoder="c:sysinternalsmp4auto"
for /f "delims=" %%F in ('dir %Location% /s /b /a-d ^| findstr /v /i /e /r %PatternName%') do (%Transcoder%manual.py -i "%%F" -a
)
This does not.
!#/bin/sh
Location="/TV Shows/*/*"
Pattern="*.mp4"
Transcode = /Mp4auto/manual.py
for Convert in (find $Location -type f ( -iname "*.*" ! -iname $Pattern ))
do
$Transcode -i $Convert -a
done
What do I need to do to get this working?
linux windows script shell-script
add a comment |
I have this batchfile that I use in Windows that I would like to translate into a Linux script. Could anyone help with that? Here is the script and the attempt at a Linux version. I did not write this, someone helped me.
The purpose is to run a python command "manual.py" which converts any file that is not an MP4 into an MP4 with FFmpeg. I have it running as a scheduled task in Windows against a mapped Linux share; however, I would rather just have the script run on the Linux box.
My Linux scripting skills are, well, non-existent.
This works
@echo off
setlocal enableDelayedExpansion
Set Location="z:movies"
Set PatternName=".*.mp4 .*srt"
Set Transcoder="c:sysinternalsmp4auto"
for /f "delims=" %%F in ('dir %Location% /s /b /a-d ^| findstr /v /i /e /r %PatternName%') do (%Transcoder%manual.py -i "%%F" -a
)
This does not.
!#/bin/sh
Location="/TV Shows/*/*"
Pattern="*.mp4"
Transcode = /Mp4auto/manual.py
for Convert in (find $Location -type f ( -iname "*.*" ! -iname $Pattern ))
do
$Transcode -i $Convert -a
done
What do I need to do to get this working?
linux windows script shell-script
add a comment |
I have this batchfile that I use in Windows that I would like to translate into a Linux script. Could anyone help with that? Here is the script and the attempt at a Linux version. I did not write this, someone helped me.
The purpose is to run a python command "manual.py" which converts any file that is not an MP4 into an MP4 with FFmpeg. I have it running as a scheduled task in Windows against a mapped Linux share; however, I would rather just have the script run on the Linux box.
My Linux scripting skills are, well, non-existent.
This works
@echo off
setlocal enableDelayedExpansion
Set Location="z:movies"
Set PatternName=".*.mp4 .*srt"
Set Transcoder="c:sysinternalsmp4auto"
for /f "delims=" %%F in ('dir %Location% /s /b /a-d ^| findstr /v /i /e /r %PatternName%') do (%Transcoder%manual.py -i "%%F" -a
)
This does not.
!#/bin/sh
Location="/TV Shows/*/*"
Pattern="*.mp4"
Transcode = /Mp4auto/manual.py
for Convert in (find $Location -type f ( -iname "*.*" ! -iname $Pattern ))
do
$Transcode -i $Convert -a
done
What do I need to do to get this working?
linux windows script shell-script
I have this batchfile that I use in Windows that I would like to translate into a Linux script. Could anyone help with that? Here is the script and the attempt at a Linux version. I did not write this, someone helped me.
The purpose is to run a python command "manual.py" which converts any file that is not an MP4 into an MP4 with FFmpeg. I have it running as a scheduled task in Windows against a mapped Linux share; however, I would rather just have the script run on the Linux box.
My Linux scripting skills are, well, non-existent.
This works
@echo off
setlocal enableDelayedExpansion
Set Location="z:movies"
Set PatternName=".*.mp4 .*srt"
Set Transcoder="c:sysinternalsmp4auto"
for /f "delims=" %%F in ('dir %Location% /s /b /a-d ^| findstr /v /i /e /r %PatternName%') do (%Transcoder%manual.py -i "%%F" -a
)
This does not.
!#/bin/sh
Location="/TV Shows/*/*"
Pattern="*.mp4"
Transcode = /Mp4auto/manual.py
for Convert in (find $Location -type f ( -iname "*.*" ! -iname $Pattern ))
do
$Transcode -i $Convert -a
done
What do I need to do to get this working?
linux windows script shell-script
linux windows script shell-script
edited Jan 6 at 6:06
Scott
15.8k113990
15.8k113990
asked Jan 6 at 1:28
Jerry RoncalliJerry Roncalli
63
63
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
There are several issues:
- The first two characters of a shell script should be
#!
, not!#
.
Assuming that you have elected to use a POSIX-type shell
(which is a good choice):
- When you assign to a variable,
there must be no space before or after the=
. - When you use (refer to) a variable,
you should almost always put it into quotes.
(What we often say is that you should always quote shell variables
unless you have a good reason not to,
and you’re sure you know what you’re doing.) - You are running the
find
command,
and taking its output and using it as part of a larger command.
You put thefind
command into parentheses.
You need to put it into$(
…)
.
But this is a bad way to do that,
and will fail if any pathnames contain space(s).
And so it will blow sky-high, because all your pathnames
will contain space(s), because your directory name is"/TV Shows"
.
I’ll get back to this.
- The first argument to
find
should generally be the name of a directory.
This is a gross oversimplification — there are lots of variations —
but the point is that you should be givingfind
an argument of"/TV Shows"
.
You don’t need to specify"/TV Shows/*/*"
;
find
will find all files under the"/TV Shows"
directory. - If you want to look at only two levels of directories, say so.
Other notes:
- Your BAT file uses the
.*srt
pattern.
But you have not explained the significance of this,
nor made any attempt to translate it into your shell script.
You use
-iname "*.*"
in yourfind
command in your shell script.
This matches all files that have a.
in their names.
(This character is known as “period”, “full stop” and “dot”.)
Not all Unix files have a period in their name,
so this is not the same as matching all files.
This is the right thing to do
if you want to exclude files that don’t have a dot in their names.
I point this out because
- People transitioning from Windows
are accustomed to thinking that*.*
means all files. - People new to Unix (and
find
, in particular)
sometimes believe that they need to say-name "*"
or something similar
to get all files, and then start specifying exclusions.
That’s not needed;find
finds all files by default. - You didn’t specify a requirement
to exclude files that don’t have a dot in their names.
- People transitioning from Windows
- The script processes all files that have a dot in their name
and don’t end with.mp4
.
This could potentially include.py
files,.txt
files, and whatever.
It’s probably safer to search for the types of files
that can be converted to MP4.
So, if you’re willing to rename your directory to TV_Shows
,
and you can guarantee that none of your file names contain space,
then this should get you started:
#!/bin/sh
Location="/TV_Shows"
Pattern="*.mp4"
Transcode=/Mp4auto/manual.py
for Convert in $(find "$Location" -type f ( -iname "*.*" ! -iname "$Pattern" ))
do
"$Transcode" -i "$Convert" -a
done
A better approach, which handles pathnames containing spaces, is to use find
’s ability to run a command on each file that it finds:
#!/bin/sh
Location="/TV Shows"
Pattern="*.mp4"
Transcode=/Mp4auto/manual.py
find "$Location" -type f ( -iname "*.*" ! -iname "$Pattern" ) -exec "$Transcode" -i {} -a ';'
You can split that long command into two lines with a (backslash):
find "$Location" -type f ( -iname "*.*" ! -iname "$Pattern" )
-exec "$Transcode" -i {} -a ';'
so the directory is actually tvshows, no spaces. All I want to exclude is .mp4 and .srt files. The linux script was actually written by someone else, and he admitted it was probably wrong, he wrote the batch file that works in windows. I was just trying to get the windows batch file translated to work in linux. Some of the files will contain spaces, they are tv shows renamed by filebot, or sonarr. How do I change the pattern variable to exclude .mp4 and .srt?
– Jerry Roncalli
Jan 6 at 7:31
so @Scott, instead of excluding could you give me an example of just converting any file with .mkv or .avi as the extension. The directory tvshows has no spaces, but under that there are hundreds of subdirectories with show names and seasons and they all have spaces.
– Jerry Roncalli
Jan 7 at 1:08
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1391047%2ftranslating-windows-script-for-use-in-linux%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
There are several issues:
- The first two characters of a shell script should be
#!
, not!#
.
Assuming that you have elected to use a POSIX-type shell
(which is a good choice):
- When you assign to a variable,
there must be no space before or after the=
. - When you use (refer to) a variable,
you should almost always put it into quotes.
(What we often say is that you should always quote shell variables
unless you have a good reason not to,
and you’re sure you know what you’re doing.) - You are running the
find
command,
and taking its output and using it as part of a larger command.
You put thefind
command into parentheses.
You need to put it into$(
…)
.
But this is a bad way to do that,
and will fail if any pathnames contain space(s).
And so it will blow sky-high, because all your pathnames
will contain space(s), because your directory name is"/TV Shows"
.
I’ll get back to this.
- The first argument to
find
should generally be the name of a directory.
This is a gross oversimplification — there are lots of variations —
but the point is that you should be givingfind
an argument of"/TV Shows"
.
You don’t need to specify"/TV Shows/*/*"
;
find
will find all files under the"/TV Shows"
directory. - If you want to look at only two levels of directories, say so.
Other notes:
- Your BAT file uses the
.*srt
pattern.
But you have not explained the significance of this,
nor made any attempt to translate it into your shell script.
You use
-iname "*.*"
in yourfind
command in your shell script.
This matches all files that have a.
in their names.
(This character is known as “period”, “full stop” and “dot”.)
Not all Unix files have a period in their name,
so this is not the same as matching all files.
This is the right thing to do
if you want to exclude files that don’t have a dot in their names.
I point this out because
- People transitioning from Windows
are accustomed to thinking that*.*
means all files. - People new to Unix (and
find
, in particular)
sometimes believe that they need to say-name "*"
or something similar
to get all files, and then start specifying exclusions.
That’s not needed;find
finds all files by default. - You didn’t specify a requirement
to exclude files that don’t have a dot in their names.
- People transitioning from Windows
- The script processes all files that have a dot in their name
and don’t end with.mp4
.
This could potentially include.py
files,.txt
files, and whatever.
It’s probably safer to search for the types of files
that can be converted to MP4.
So, if you’re willing to rename your directory to TV_Shows
,
and you can guarantee that none of your file names contain space,
then this should get you started:
#!/bin/sh
Location="/TV_Shows"
Pattern="*.mp4"
Transcode=/Mp4auto/manual.py
for Convert in $(find "$Location" -type f ( -iname "*.*" ! -iname "$Pattern" ))
do
"$Transcode" -i "$Convert" -a
done
A better approach, which handles pathnames containing spaces, is to use find
’s ability to run a command on each file that it finds:
#!/bin/sh
Location="/TV Shows"
Pattern="*.mp4"
Transcode=/Mp4auto/manual.py
find "$Location" -type f ( -iname "*.*" ! -iname "$Pattern" ) -exec "$Transcode" -i {} -a ';'
You can split that long command into two lines with a (backslash):
find "$Location" -type f ( -iname "*.*" ! -iname "$Pattern" )
-exec "$Transcode" -i {} -a ';'
so the directory is actually tvshows, no spaces. All I want to exclude is .mp4 and .srt files. The linux script was actually written by someone else, and he admitted it was probably wrong, he wrote the batch file that works in windows. I was just trying to get the windows batch file translated to work in linux. Some of the files will contain spaces, they are tv shows renamed by filebot, or sonarr. How do I change the pattern variable to exclude .mp4 and .srt?
– Jerry Roncalli
Jan 6 at 7:31
so @Scott, instead of excluding could you give me an example of just converting any file with .mkv or .avi as the extension. The directory tvshows has no spaces, but under that there are hundreds of subdirectories with show names and seasons and they all have spaces.
– Jerry Roncalli
Jan 7 at 1:08
add a comment |
There are several issues:
- The first two characters of a shell script should be
#!
, not!#
.
Assuming that you have elected to use a POSIX-type shell
(which is a good choice):
- When you assign to a variable,
there must be no space before or after the=
. - When you use (refer to) a variable,
you should almost always put it into quotes.
(What we often say is that you should always quote shell variables
unless you have a good reason not to,
and you’re sure you know what you’re doing.) - You are running the
find
command,
and taking its output and using it as part of a larger command.
You put thefind
command into parentheses.
You need to put it into$(
…)
.
But this is a bad way to do that,
and will fail if any pathnames contain space(s).
And so it will blow sky-high, because all your pathnames
will contain space(s), because your directory name is"/TV Shows"
.
I’ll get back to this.
- The first argument to
find
should generally be the name of a directory.
This is a gross oversimplification — there are lots of variations —
but the point is that you should be givingfind
an argument of"/TV Shows"
.
You don’t need to specify"/TV Shows/*/*"
;
find
will find all files under the"/TV Shows"
directory. - If you want to look at only two levels of directories, say so.
Other notes:
- Your BAT file uses the
.*srt
pattern.
But you have not explained the significance of this,
nor made any attempt to translate it into your shell script.
You use
-iname "*.*"
in yourfind
command in your shell script.
This matches all files that have a.
in their names.
(This character is known as “period”, “full stop” and “dot”.)
Not all Unix files have a period in their name,
so this is not the same as matching all files.
This is the right thing to do
if you want to exclude files that don’t have a dot in their names.
I point this out because
- People transitioning from Windows
are accustomed to thinking that*.*
means all files. - People new to Unix (and
find
, in particular)
sometimes believe that they need to say-name "*"
or something similar
to get all files, and then start specifying exclusions.
That’s not needed;find
finds all files by default. - You didn’t specify a requirement
to exclude files that don’t have a dot in their names.
- People transitioning from Windows
- The script processes all files that have a dot in their name
and don’t end with.mp4
.
This could potentially include.py
files,.txt
files, and whatever.
It’s probably safer to search for the types of files
that can be converted to MP4.
So, if you’re willing to rename your directory to TV_Shows
,
and you can guarantee that none of your file names contain space,
then this should get you started:
#!/bin/sh
Location="/TV_Shows"
Pattern="*.mp4"
Transcode=/Mp4auto/manual.py
for Convert in $(find "$Location" -type f ( -iname "*.*" ! -iname "$Pattern" ))
do
"$Transcode" -i "$Convert" -a
done
A better approach, which handles pathnames containing spaces, is to use find
’s ability to run a command on each file that it finds:
#!/bin/sh
Location="/TV Shows"
Pattern="*.mp4"
Transcode=/Mp4auto/manual.py
find "$Location" -type f ( -iname "*.*" ! -iname "$Pattern" ) -exec "$Transcode" -i {} -a ';'
You can split that long command into two lines with a (backslash):
find "$Location" -type f ( -iname "*.*" ! -iname "$Pattern" )
-exec "$Transcode" -i {} -a ';'
so the directory is actually tvshows, no spaces. All I want to exclude is .mp4 and .srt files. The linux script was actually written by someone else, and he admitted it was probably wrong, he wrote the batch file that works in windows. I was just trying to get the windows batch file translated to work in linux. Some of the files will contain spaces, they are tv shows renamed by filebot, or sonarr. How do I change the pattern variable to exclude .mp4 and .srt?
– Jerry Roncalli
Jan 6 at 7:31
so @Scott, instead of excluding could you give me an example of just converting any file with .mkv or .avi as the extension. The directory tvshows has no spaces, but under that there are hundreds of subdirectories with show names and seasons and they all have spaces.
– Jerry Roncalli
Jan 7 at 1:08
add a comment |
There are several issues:
- The first two characters of a shell script should be
#!
, not!#
.
Assuming that you have elected to use a POSIX-type shell
(which is a good choice):
- When you assign to a variable,
there must be no space before or after the=
. - When you use (refer to) a variable,
you should almost always put it into quotes.
(What we often say is that you should always quote shell variables
unless you have a good reason not to,
and you’re sure you know what you’re doing.) - You are running the
find
command,
and taking its output and using it as part of a larger command.
You put thefind
command into parentheses.
You need to put it into$(
…)
.
But this is a bad way to do that,
and will fail if any pathnames contain space(s).
And so it will blow sky-high, because all your pathnames
will contain space(s), because your directory name is"/TV Shows"
.
I’ll get back to this.
- The first argument to
find
should generally be the name of a directory.
This is a gross oversimplification — there are lots of variations —
but the point is that you should be givingfind
an argument of"/TV Shows"
.
You don’t need to specify"/TV Shows/*/*"
;
find
will find all files under the"/TV Shows"
directory. - If you want to look at only two levels of directories, say so.
Other notes:
- Your BAT file uses the
.*srt
pattern.
But you have not explained the significance of this,
nor made any attempt to translate it into your shell script.
You use
-iname "*.*"
in yourfind
command in your shell script.
This matches all files that have a.
in their names.
(This character is known as “period”, “full stop” and “dot”.)
Not all Unix files have a period in their name,
so this is not the same as matching all files.
This is the right thing to do
if you want to exclude files that don’t have a dot in their names.
I point this out because
- People transitioning from Windows
are accustomed to thinking that*.*
means all files. - People new to Unix (and
find
, in particular)
sometimes believe that they need to say-name "*"
or something similar
to get all files, and then start specifying exclusions.
That’s not needed;find
finds all files by default. - You didn’t specify a requirement
to exclude files that don’t have a dot in their names.
- People transitioning from Windows
- The script processes all files that have a dot in their name
and don’t end with.mp4
.
This could potentially include.py
files,.txt
files, and whatever.
It’s probably safer to search for the types of files
that can be converted to MP4.
So, if you’re willing to rename your directory to TV_Shows
,
and you can guarantee that none of your file names contain space,
then this should get you started:
#!/bin/sh
Location="/TV_Shows"
Pattern="*.mp4"
Transcode=/Mp4auto/manual.py
for Convert in $(find "$Location" -type f ( -iname "*.*" ! -iname "$Pattern" ))
do
"$Transcode" -i "$Convert" -a
done
A better approach, which handles pathnames containing spaces, is to use find
’s ability to run a command on each file that it finds:
#!/bin/sh
Location="/TV Shows"
Pattern="*.mp4"
Transcode=/Mp4auto/manual.py
find "$Location" -type f ( -iname "*.*" ! -iname "$Pattern" ) -exec "$Transcode" -i {} -a ';'
You can split that long command into two lines with a (backslash):
find "$Location" -type f ( -iname "*.*" ! -iname "$Pattern" )
-exec "$Transcode" -i {} -a ';'
There are several issues:
- The first two characters of a shell script should be
#!
, not!#
.
Assuming that you have elected to use a POSIX-type shell
(which is a good choice):
- When you assign to a variable,
there must be no space before or after the=
. - When you use (refer to) a variable,
you should almost always put it into quotes.
(What we often say is that you should always quote shell variables
unless you have a good reason not to,
and you’re sure you know what you’re doing.) - You are running the
find
command,
and taking its output and using it as part of a larger command.
You put thefind
command into parentheses.
You need to put it into$(
…)
.
But this is a bad way to do that,
and will fail if any pathnames contain space(s).
And so it will blow sky-high, because all your pathnames
will contain space(s), because your directory name is"/TV Shows"
.
I’ll get back to this.
- The first argument to
find
should generally be the name of a directory.
This is a gross oversimplification — there are lots of variations —
but the point is that you should be givingfind
an argument of"/TV Shows"
.
You don’t need to specify"/TV Shows/*/*"
;
find
will find all files under the"/TV Shows"
directory. - If you want to look at only two levels of directories, say so.
Other notes:
- Your BAT file uses the
.*srt
pattern.
But you have not explained the significance of this,
nor made any attempt to translate it into your shell script.
You use
-iname "*.*"
in yourfind
command in your shell script.
This matches all files that have a.
in their names.
(This character is known as “period”, “full stop” and “dot”.)
Not all Unix files have a period in their name,
so this is not the same as matching all files.
This is the right thing to do
if you want to exclude files that don’t have a dot in their names.
I point this out because
- People transitioning from Windows
are accustomed to thinking that*.*
means all files. - People new to Unix (and
find
, in particular)
sometimes believe that they need to say-name "*"
or something similar
to get all files, and then start specifying exclusions.
That’s not needed;find
finds all files by default. - You didn’t specify a requirement
to exclude files that don’t have a dot in their names.
- People transitioning from Windows
- The script processes all files that have a dot in their name
and don’t end with.mp4
.
This could potentially include.py
files,.txt
files, and whatever.
It’s probably safer to search for the types of files
that can be converted to MP4.
So, if you’re willing to rename your directory to TV_Shows
,
and you can guarantee that none of your file names contain space,
then this should get you started:
#!/bin/sh
Location="/TV_Shows"
Pattern="*.mp4"
Transcode=/Mp4auto/manual.py
for Convert in $(find "$Location" -type f ( -iname "*.*" ! -iname "$Pattern" ))
do
"$Transcode" -i "$Convert" -a
done
A better approach, which handles pathnames containing spaces, is to use find
’s ability to run a command on each file that it finds:
#!/bin/sh
Location="/TV Shows"
Pattern="*.mp4"
Transcode=/Mp4auto/manual.py
find "$Location" -type f ( -iname "*.*" ! -iname "$Pattern" ) -exec "$Transcode" -i {} -a ';'
You can split that long command into two lines with a (backslash):
find "$Location" -type f ( -iname "*.*" ! -iname "$Pattern" )
-exec "$Transcode" -i {} -a ';'
edited Jan 6 at 5:57
answered Jan 6 at 5:43
ScottScott
15.8k113990
15.8k113990
so the directory is actually tvshows, no spaces. All I want to exclude is .mp4 and .srt files. The linux script was actually written by someone else, and he admitted it was probably wrong, he wrote the batch file that works in windows. I was just trying to get the windows batch file translated to work in linux. Some of the files will contain spaces, they are tv shows renamed by filebot, or sonarr. How do I change the pattern variable to exclude .mp4 and .srt?
– Jerry Roncalli
Jan 6 at 7:31
so @Scott, instead of excluding could you give me an example of just converting any file with .mkv or .avi as the extension. The directory tvshows has no spaces, but under that there are hundreds of subdirectories with show names and seasons and they all have spaces.
– Jerry Roncalli
Jan 7 at 1:08
add a comment |
so the directory is actually tvshows, no spaces. All I want to exclude is .mp4 and .srt files. The linux script was actually written by someone else, and he admitted it was probably wrong, he wrote the batch file that works in windows. I was just trying to get the windows batch file translated to work in linux. Some of the files will contain spaces, they are tv shows renamed by filebot, or sonarr. How do I change the pattern variable to exclude .mp4 and .srt?
– Jerry Roncalli
Jan 6 at 7:31
so @Scott, instead of excluding could you give me an example of just converting any file with .mkv or .avi as the extension. The directory tvshows has no spaces, but under that there are hundreds of subdirectories with show names and seasons and they all have spaces.
– Jerry Roncalli
Jan 7 at 1:08
so the directory is actually tvshows, no spaces. All I want to exclude is .mp4 and .srt files. The linux script was actually written by someone else, and he admitted it was probably wrong, he wrote the batch file that works in windows. I was just trying to get the windows batch file translated to work in linux. Some of the files will contain spaces, they are tv shows renamed by filebot, or sonarr. How do I change the pattern variable to exclude .mp4 and .srt?
– Jerry Roncalli
Jan 6 at 7:31
so the directory is actually tvshows, no spaces. All I want to exclude is .mp4 and .srt files. The linux script was actually written by someone else, and he admitted it was probably wrong, he wrote the batch file that works in windows. I was just trying to get the windows batch file translated to work in linux. Some of the files will contain spaces, they are tv shows renamed by filebot, or sonarr. How do I change the pattern variable to exclude .mp4 and .srt?
– Jerry Roncalli
Jan 6 at 7:31
so @Scott, instead of excluding could you give me an example of just converting any file with .mkv or .avi as the extension. The directory tvshows has no spaces, but under that there are hundreds of subdirectories with show names and seasons and they all have spaces.
– Jerry Roncalli
Jan 7 at 1:08
so @Scott, instead of excluding could you give me an example of just converting any file with .mkv or .avi as the extension. The directory tvshows has no spaces, but under that there are hundreds of subdirectories with show names and seasons and they all have spaces.
– Jerry Roncalli
Jan 7 at 1:08
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1391047%2ftranslating-windows-script-for-use-in-linux%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown