Dear all,
I am looking for a simplified solution for renaming files through shell scripts.
I need the file names in continuous numerical order, i.e. from
M?L01.mp4 to M?L30.mp4
So, the file
M2L01.mp4 should be renamed to M2L11.mp4 and
M3L01.mp4 should be renamed to M3L21.mp4
M1L01.mp4
M1L02.mp
Hi,
--- On Wed, Oct 28, 2015 at 12:56 PM, Baskar Selvaraj
wrote:
| M2L01.mp4 should be renamed to M2L11.mp4 and
| M3L01.mp4 should be renamed to M3L21.mp4
\--
M1L10.mp4 can be renamed to M1L00.mp4? Here is a quickly hacked up Ruby script:
=== test.rb ===
#!/usr/bin/env ruby
Dir.glob("*.mp4").
> === test.rb ===
>
> #!/usr/bin/env ruby
>
> Dir.glob("*.mp4").each do |f|
> new_f = f.dup
> new_f[3] = (f[1].to_i - 1).to_s
>
> File.rename(f, new_f)
> end
>
> === END ===
Hi,
Thanks for the script
The scripts works, but the results were different, if the value after L is < 10.
input:
Hi,
--- On Wed, Oct 28, 2015 at 2:55 PM, Baskar Selvaraj
wrote:
| The scripts works, but the results were different, if the value
after L is < 10.
\--
That is the question I had asked in my previous reply. What should be
the expected behavior in such a case?
SK
--
Shakthi Kannan
http://www.sh
On Wed, Oct 28, 2015 at 3:03 PM, Shakthi Kannan
wrote:
> Hi,
>
> --- On Wed, Oct 28, 2015 at 2:55 PM, Baskar Selvaraj
> wrote:
> | The scripts works, but the results were different, if the value
> after L is < 10.
> \--
>
> That is the question I had asked in my previous reply. What should be
>
Hi,
On 20 October 2015 at 11:11, sahil साहिल
wrote:
> I am struggling to block pop-ups while searching on my Tablet on
> Chrome/Firefox browsers. Sometimes it is so disturbing and annoying while I
> search something along with kids and all of sudden some obscene sites
> comes. Do you guys have a
Hi,
--- On Wed, Oct 28, 2015 at 5:38 PM, Baskar Selvaraj
wrote:
| Now the requirement is to remove the modules from the filenames and have
| only lectures in consecutive numerical order
|
| M1L1.mp4
| M1L2.mp4
| ...
\--
New requirements! This is not what you mentioned in your initial
e-mail (whe
Hi Baskar,
you can try this
i=1
cd *test*
for name in `ls | sort`;
do
temp=`echo $name | cut -c 1-3`;
if [ $i -lt 10 ]
then
newname=$temp;
newname+="0$i.mp4";
echo $name renamed to $newname;
mv $name $newname
else
newname="$temp$i.mp4";
echo $name renamed to $newname;
mv $name $newname
fi
i=$((i+
On 10/28/15, Vinoth Marimuthu wrote:
> Hi Baskar,
>
> you can try this
>
> i=1
> cd *test*
> for name in `ls | sort`;
> do
> temp=`echo $name | cut -c 1-3`;
> if [ $i -lt 10 ]
> then
> newname=$temp;
> newname+="0$i.mp4";
> echo $name renamed to $newname;
> mv $name $newname
> else
> newname="$tem
> | Now the requirement is to remove the modules from the filenames and have
> | only lectures in consecutive numerical order
> |
> | M1L1.mp4
> | M1L2.mp4
> | ...
> \--
>
> New requirements! This is not what you mentioned in your initial
> e-mail (where it was M1L01.mp4, M1L02.mp4 etc).
>
Sorry f
Hi,
--- On Wed, Oct 28, 2015 at 9:24 PM, Baskar Selvaraj
wrote:
| Thanks, it worked.
\--
Did you understand what the script did?
SK
--
Shakthi Kannan
http://www.shakthimaan.com
___
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
On 10/28/15, Shakthi Kannan wrote:
> Hi,
>
> --- On Wed, Oct 28, 2015 at 9:24 PM, Baskar Selvaraj
> wrote:
> | Thanks, it worked.
> \--
>
> Did you understand what the script did?
Bash script: Yes
Ruby script: No (as I have learn ruby)
S. Baskar
___
I
Hi,
--- On Wed, Oct 28, 2015 at 9:49 PM, Baskar Selvaraj
wrote:
| Ruby script: No (as I have learn ruby)
\--
Please take some time to learn. For a start:
https://www.ruby-lang.org/en/documentation/quickstart/
http://tryruby.org/levels/1/challenges/0
SK
--
Shakthi Kannan
http://www.shakt
13 matches
Mail list logo