LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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, 02:40 AM   #1
alan.belizario
LQ Newbie
 
Registered: Mar 2005
Location: Philippines
Posts: 13

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, 02:50 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

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

Last edited by acid_kewpie; 03-30-2005 at 02:51 AM.
 
Old 03-30-2005, 04:32 AM   #3
keefaz
Senior Member
 
Registered: Mar 2004
Distribution: Slackware
Posts: 4,617

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

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, 05:49 AM   #5
keefaz
Senior Member
 
Registered: Mar 2004
Distribution: Slackware
Posts: 4,617

Rep: Reputation: 136Reputation: 136
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, 01:41 AM   #6
alan.belizario
LQ Newbie
 
Registered: Mar 2005
Location: Philippines
Posts: 13

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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


All times are GMT -5. The time now is 10:09 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration