![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Root Password change | bullz26 | SUN Solaris | 2 | 03-30-2008 12:09 PM |
| How to change ROOT password. | angelofhell | HP-UX | 3 | 02-25-2008 06:44 AM |
| change root password | duke0001 | SUN Solaris | 3 | 02-22-2007 12:10 PM |
| how do i change extension | kswaraj | Shell Programming and Scripting | 2 | 06-28-2004 09:07 PM |
| How to change extension? | prkwan | Shell Programming and Scripting | 4 | 11-16-2002 07:14 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
change file extension from root and subdirectories
Hello, my first post!
I'd appreciate help with this script, I'm new to this. I have a media directory where I want to batch convert image file names from .img to .iso. I've tried but get: $ ./img2iso2.sh ./img2iso2.sh: line 13: syntax error: unexpected end of file ![]() This is my unfinished script: Code:
#!/bin/bash
# Set the video directory here
VIDEO_ROOT_DIRECTORY="/Users/astrid/NFS/scripts/img2iso/";
# Check if the directory exist or not
if [ -d "$VIDEO_ROOT_DIRECTORY" ]; then
cd $VIDEO_ROOT_DIRECTORY
else
print "ERROR: Unable to reach directory - or it does not exist!";
fi
for imgfile do
case $imgfile *.img
do mv $imgfile.img $imgfile.iso;
done
print "img-files renamed to iso";
esac
done
exit 0
Also, I'd think it would be smart to include some sort of check: if there is a file called image.iso and one called image.img in the same (sub)directory; I'd like to change the name of that .img file to image-1.iso. But I don't even know where to start with this check! If I understand the error message there's a problem with quoting? I've made so many trials that I can't remember where I started anymore. Any help is greatly appreciated. EDIT: Searching the forum I found a better way to do the replacement of the file extension (here), but I wasn't so lucky with the subdirs. Last edited by Astrid; 02-15-2008 at 03:43 PM.. |
| Bookmarks |
| Tags |
| linux, linux commands, unix commands |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|