LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-07-2017, 02:07 PM   #46
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,635

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965

Quote:
Originally Posted by ondoho View Post
^ like prefabricated answers?
it could help.
personally i do not usually have the patience to formulate a comprehensible (simple english) answer for cases like these, even if the answer is always very similar...i think this has been discussed before, here on LQ.
Honestly, I think it's a noble effort, and genuinely hope it DOES help.

The reality is, though, that we'll all still see the same questions, and even if we answer with "Well, there's a FAQ that answers that", the follow up will probably be "Pls provide the link". We'll not only have to direct them there, but hand them the link, then have to explain what the command(s) are one by one.

And the wheels on the bus go round and round.....
 
Old 05-07-2017, 05:13 PM   #47
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by ondoho View Post
^ like prefabricated answers?
it could help.
personally i do not usually have the patience to formulate a comprehensible (simple english) answer for cases like these, even if the answer is always very similar...
i think this has been discussed before, here on LQ.
It's called your LQ blog if people wish to can examples.

Note though that there are already tons of web examples out there.
 
3 members found this post helpful.
Old 05-11-2017, 09:41 AM   #48
rupeshforu3
Member
 
Registered: Jun 2013
Location: India
Distribution: any Linux, BSD, Solaris, sco unixware, Windows 8
Posts: 59

Original Poster
Rep: Reputation: 0
OK someone created a batch script in windows and posted and I am providing it below

Code:
@echo off
setlocal EnableExtensions DisableDelayedExpansion

rem // Define constants here:
set "_SOURCE=C:\Rupesh\to convert"
set "_TARGET=E:\Rupesh\ffmpeg out"

rem // Change to source directory temporarily:
pushd "%_SOURCE%" || exit /B 1
rem // Enumerate source files, return paths relative to the source directory:
for /F "delims=" %%F in ('xcopy /L /S /I ".\*.mp3" "%_TARGET%" ^| find ".\"') do (
    echo Currently converting "%%F"...
    rem // Create destination directory, suppress error if it aready exists:
    mkdir "%_TARGET%\%%F\.." 2> nul
    rem // Perform actual file conversion, using paths relative to target directory:
    ffmpeg -i  "%%F" -v quiet -codec:a libmp3lame -b:a 16k -ar 11025 -map_metadata 0 -id3v2_version 3 -write_id3v1 1 "%_TARGET%\%%F\..\%%~nF.mp3"
)
echo Completed.
popd

endlocal
exit /B
Can anyone of you convert the above code and create a shell script and post it.
 
Old 05-11-2017, 09:55 AM   #49
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by rupeshforu3 View Post
Can anyone of you convert the above code and create a shell script and post it.
Why haven't you attempted this?

Seems to me that it can nearly be translated to bash almost line for line.

Suggest you give it a go and show others here your attempt. This will at least give us insight into your script capabilities so we can offer improvements for your script in line with the expertise you've demonstrated.
 
Old 05-11-2017, 11:12 AM   #50
rupeshforu3
Member
 
Registered: Jun 2013
Location: India
Distribution: any Linux, BSD, Solaris, sco unixware, Windows 8
Posts: 59

Original Poster
Rep: Reputation: 0
May be in future by reading a number of books I may be able to create a script or convert batch file to shell script but at present I am not.

At present I am even unable to copy the directory structure I mean directory same as source without files. What is the equivalent command of xcopy in Linux.
 
Old 05-11-2017, 11:14 AM   #51
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by rupeshforu3 View Post
May be in future by reading a number of books I may be able to create a script or convert batch file to shell script but at present I am not.

At present I am even unable to copy the directory structure I mean directory same as source without files. What is the equivalent command of xcopy in Linux.
cp(1) command using the -r option.
 
Old 05-11-2017, 11:14 AM   #52
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,862
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
@OP: Please show some effort, here you have examples how to use find(1)

Last edited by NevemTeve; 05-11-2017 at 11:15 AM.
 
Old 05-11-2017, 12:53 PM   #53
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by rupeshforu3 View Post
[/code]Can anyone of you convert the above code and create a shell script and post it.
i can't believe you couldn't find a single linux example online.
what search terms did you use to come up with that?
you know your search should contain "linux" if you want linux solutions?
you know what you want is called "transcode" or "transcoding"?
 
Old 05-11-2017, 01:21 PM   #54
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,224

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
Linking to the Windows script:

Recursively Converting FLAC to MP3 Using FFmpeg While Maintaining Metadata and Directory Structure on Windows - Stack Overflow
 
1 members found this post helpful.
Old 05-11-2017, 01:30 PM   #55
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by rupeshforu3 View Post
May be in future by reading a number of books I may be able to create a script or convert batch file to shell script but at present I am not.

At present I am even unable to copy the directory structure I mean directory same as source without files. What is the equivalent command of xcopy in Linux.
I feel that you are failing to put in any effort towards this and showing a pattern of behavior as TB0ne has cited.

I also feel that with very little study, a person can learn how to write a rudimentary bash script within minutes.

Last edited by rtmistler; 05-11-2017 at 01:36 PM.
 
2 members found this post helpful.
Old 05-11-2017, 01:33 PM   #56
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,224

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
Quote:
Originally Posted by rupeshforu3 View Post
Can anyone of you convert the above code and create a shell script and post it.
Yes.

But we won't because we don't like your attitude or the way you asked.

Note that one of the questions I brought up (are any of the MP3s in paths that have spaces? do the filenames themselves have spaces?) is one that you should have commented on by now.

Last edited by dugan; 05-11-2017 at 01:43 PM.
 
1 members found this post helpful.
Old 05-11-2017, 02:15 PM   #57
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
@rupeshforu3

You have expended great effort to try to have someone else perform your task for you, without expending any effort of your own on the task itself.

You obviously know how to use a search engine and even the search feature of this forum, as you were able to deliberately search out counter examples to support your request for a working script, both here and in other fora, for this same question.

And you are able to find similar scripts such as the windows batch file you pasted above.

So you have demonstrated both that you are able to find specific information, and that you are simply unwilling to use what you find or learn from it.

I honestly can say that if you had spent just this same effort trying to understand how to approach you problem, and considered the answers already given, you would be well on your way to a solution and armed with knowledge for future tasks. No need to read years worth of books, as you say.

Such behavior is not acceptable here at LQ.

Please refrain from this behavior in the future as it goes against acceptable use of these fora, of which you have been previously made aware, it diverts valuable member's time from answering the questions of others more willing to learn, and is generally disrespectful of those who have taken the time to read and respond to your posts.

Please take this as a gentle warning and try to put forth some effort on your own tasks, and to work within the spirit and guidelines of LQ participation.
 
1 members found this post helpful.
Old 05-11-2017, 02:24 PM   #58
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
^ you are going to have to use simpler words if you want to get the message across, i guess.


not the first time i see people simply posting the exact copy-pasted same question on various forums.
some even say "it is normal".
 
Old 05-11-2017, 03:27 PM   #59
Laserbeak
Member
 
Registered: Jan 2017
Location: Manhattan, NYC NY
Distribution: Mac OS X, iOS, Solaris
Posts: 508

Rep: Reputation: 143Reputation: 143
OMG, you guys had this person totally pegged!
 
Old 05-11-2017, 03:32 PM   #60
Laserbeak
Member
 
Registered: Jan 2017
Location: Manhattan, NYC NY
Distribution: Mac OS X, iOS, Solaris
Posts: 508

Rep: Reputation: 143Reputation: 143
I believe everything necessary to make your little script is in this thread, you just have to put it all together.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
command to copy mp3 files recursively ejames82 Linux - General 8 11-15-2016 04:34 PM
[SOLVED] Script compressing the files in a directory in numerous servers arvindk.monu Linux - Newbie 6 04-17-2012 11:54 AM
Remove Folders Recursively that contain *.mp3 files size 0KB or jpeg only. Drigo Linux - Newbie 1 07-15-2009 12:37 AM
how to join two mp3 files in ffmpeg yajur Programming 1 10-22-2008 06:00 PM
Script for compressing files older than one year Pengu010011 Linux - Newbie 2 10-26-2004 07:53 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration