LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Change batch script to shell script (https://www.linuxquestions.org/questions/programming-9/change-batch-script-to-shell-script-307659/)

alan.belizario 03-30-2005 01:40 AM

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 ..

acid_kewpie 03-30-2005 01:50 AM

should just need to change ren to mv.

keefaz 03-30-2005 03:32 AM

And replace %1 with $1

alan.belizario 03-30-2005 04:42 AM

Well i did that but an error occured when i run the script mv --help always pop up.

keefaz 03-30-2005 04:49 AM

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)

alan.belizario 03-31-2005 12:41 AM

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.


All times are GMT -5. The time now is 05:58 AM.