LinuxQuestions.org
Help answer threads with 0 replies.
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 03-30-2005, 01:40 AM   #1
alan.belizario
LQ Newbie
 
Registered: Mar 2005
Location: Philippines
Posts: 16

Rep: Reputation: 0
Change batch script to shell script


Help! How can i change this batch script to shell script?

cd WORLD
ren 2*.html "2004%1wor??.*"
cd ..

cd TOP_ST~1
ren 2*.html "2004%1top??.*"
cd ..

cd SPORTS
ren 2*.html "2004%1spo??.*"
cd ..

cd PROV
ren 2*.html "2004%1pro??.*"
cd ..

cd OPINION
ren 2*.html "2004%1opi??.*"
cd ..

cd METRO
ren 2*.html "2004%1met??.*"
cd ..

cd LIFE
ren 2*.html "2004%1lif??.*"
cd ..

cd ENTER
ren 2*.html "2004%1ent??.*"
cd ..

cd BUSINESS
ren 2*.html "2004%1bus??.*"
cd ..
 
Old 03-30-2005, 01:50 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
should just need to change ren to mv.

Last edited by acid_kewpie; 03-30-2005 at 01:51 AM.
 
Old 03-30-2005, 03:32 AM   #3
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
And replace %1 with $1
 
Old 03-30-2005, 04:42 AM   #4
alan.belizario
LQ Newbie
 
Registered: Mar 2005
Location: Philippines
Posts: 16

Original Poster
Rep: Reputation: 0
Well i did that but an error occured when i run the script mv --help always pop up.
 
Old 03-30-2005, 04:49 AM   #5
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Are you sure this batch work fine in dos ?

And could you post the output with
ls WORLD/2*.html

Also how do you invoke your batch (with an argument or not)
 
Old 03-31-2005, 12:41 AM   #6
alan.belizario
LQ Newbie
 
Registered: Mar 2005
Location: Philippines
Posts: 16

Original Poster
Rep: Reputation: 0
Yup batch script work well on win nt and win 98. this is how the batch file works, first we place the .bat file in the directory where the .html files are then we execute the .bat file by clicking it then a popup window will appear what prefix we want to rename it to.


Can you help me? This will help me to lessen my time in renaming my files.
 
  


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
any shell script 2 batch file tools? rosbur Linux - General 12 11-27-2018 12:20 PM
Change batch script to shell script alan.belizario Linux - Software 1 03-30-2005 01:49 AM
Help w/ batch/shell script mikehlinuxquest Linux - General 5 09-13-2004 04:41 PM
How can i change the icon of a shell script? BajaNick Linux - Software 6 01-14-2004 12:56 AM
Shell script to change IP addresses saintt Linux - General 4 08-20-2001 11:17 AM

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

All times are GMT -5. The time now is 12:27 AM.

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