Sridhar Dhanapalan wrote:
>On Tue, 24 Sep 2002 16:18:08 +0100, John Richard Smith
><[EMAIL PROTECTED]> wrote:
>
>
>>Sridhar Dhanapalan wrote,
>>
>>
>>>
>>>
>>>>Many thanks Sridhar,
>>>>Can I run my results past you again.
>>>>I copied the perl text to a text file called chcase and inserted it
>>>>in /usr/local/bin, as follows,
>>>>
>>>>root]# cd /usr/local/bin
>>>> bin]# ls
>>>>chcase divxPlayer* fsgrab* lexmarkz53@ mplayer*
>>>>compupic@ divxPlayer.bin* gmplayer@ lxsetconf@
>>>>cvs_mplayer* e2recover* gxset* mencoder*
>>>>
>>>>bin]# cd
>>>>root]# chmod 755 chcase
>>>>chmod: failed to get attributes of `chcase': No such file or directory
>>>>I do not understand ? what attributes ?
>>>>
>>>>
>
>That's strange. Are you still in the directory that contains the chcase file?
>
Yes, /usr/local/bin/chcase.
>
>
>
>>root]# # chmod 755 chcase
>>
>>
>
>The # signifies a root prompt. You are not meant to type it. If you do, it will
>ignore the command.
>
That's what I thought, but it likes it, without it , rejection. It's odd.
>
>
>
>>root]#
>>It didn't seem to mind this.so,
>>
>>root]# cd /root/Desktop/mont
>>
>>mont]# ls
>>DSCI0001.JPG DSCI0004.JPG DSCI0007.JPG DSCI0010.JPG DSCI0013.JPG
>>DSCI0002.JPG DSCI0005.JPG DSCI0008.JPG DSCI0011.JPG DSCI0014.JPG
>>DSCI0003.JPG DSCI0006.JPG DSCI0009.JPG DSCI0012.JPG
>>All present and correct.
>>
>>mont]# chcase
>>bash: /usr/local/bin/chcase: Permission denied
>>So I went to directory mont and gave all the permissions,but,
>>
>>mont]# chcase
>>bash: /usr/local/bin/chcase: Permission denied
>>still permission denied
>>
>>I guess it is something to do with the way the first, chmod 755 chcase
>>was rejected, while,# chmod 755 chcase was accepted , could this be
>>correct do you think.Note the inclusion of the #
>>Any further ideas ?
>>
>>
>
>Make sure chcase is owned by root:
>
> # chown root:root /usr/local/bin/chcase
>
>Then check its permissions:
>
> # ls -la /usr/local/bin/chcase
>
>Leave the # out when typing these (as I have explained above). You should get
>something like:
>
> -rwxr-xr-x 1 root root 3921 Sep 25 2002 /usr/local/bin/chcase*
>
>Make sure the permissions are "-rwxr-xr-x" (as above), and that the owner and
>group are root.
>
[root@localhost root]# chown root:root /usr/local/bin/chcase
[root@localhost root]# ls -la /usr/local/bin/chcase
-rw-r--r-- 1 root root 3921 Sep 24 15:29
/usr/local/bin/chcase
This is not working. I suspect something is overriding
the command and changing it back.It seems that
it does not matter if I issue the above command , or go
to the permissions window for /usr/local/bin/chcase and
insert x in the right places. Something removes them.
But,
[root@localhost root]# cd /root/Desktop/mont (where the .JPG files are
stored)
[root@localhost mont]# chcase
Setuid/gid script is writable by world.
[root@localhost mont]# ls -la /usr/local/bin/chcase
-rwsrwsrw- 1 root root 3921 Sep 24 15:29
/usr/local/bin/chcase*
This is Wierd,
So lets try again, fresh terminal,
[root@localhost root]# chmod 755 chcase
chmod: failed to get attributes of `chcase': No such file or directory
you don't think maybe it ought to be chmod 755 /usr/local/bin/chcase,
so lets try,
[root@localhost root]# chmod 755 /usr/local/bin/chcase
[root@localhost root]#
that's better,
[root@localhost mont]# chcase
chcase 1.2
USAGE:
chcase [-erdouqnl] [-s <dir>] [-x '<perl exp>'] '<mask>'
-e : Print EXAMPLES - very helpful!
-r : Rename recursively
-d : Also rename subdirectories
-o : Overwrite if file exists
-u : Change to upper case (default is lower)
-q : Quiet mode (no output)
-n : No escape characters (for bold output)
-l : Rename & follow symbolic links (default is not to)
-s <dir> : Specify starting directory
-x '<perl exp>' : Perl expression to operate on filename
usually s/// or tr/// (yes you need the quotes)
case of filename not changed when this option used
you can supply multiple expressions
'<mask>' : Mask to rename (quotes are nice to have here)
not case sensitive, you can use multiple masks
-or- just supply the filename(s) on the command line
[root@localhost mont]#
now that's a lot better.
So which is the correct option to rename in lower case ?
I will try , since I am in the directory that contains the .JPG files,
[root@localhost mont]# chcase -e
chcase 1.2
EXAMPLES:
> chcase My.DOC *.JPG FileName.txt
=> these specific files are changed to lower case
> chcase -rd '*'
=> all files and sub dirs to lower case, start in current dir, recurse
> chcase -s pics '*.jpg' '*.gif'
=> rename .jpg and .gif files in pics dir to lower case
> chcase -rous /tmp/junk 'a??b*.txt'
=> starting from /tmp/junk and recursing, change files matching this
mask to all upper case, overwrite if file exists
> chcase -x 's/99dec/jan2000/' -x 's/ /_/g' '*.doc'
=> renames *.doc files replacing 99dec with jan2000,
and replacing all spaces with underscores
> chcase -x 'tr/a-zA-Z0-9.//cd' -x 's/jpg/jpg/i' '*'
=> removes all non-alphanumeric characters except for '.' and
changes the pattern "jpg" to lower case if it isn't already
> chcase -r
=> displays directory structure
So I'm guessing but,
[root@localhost mont]# chcase -rd
.
[root@localhost mont]#
[root@localhost mont]#
[root@localhost mont]# It seemed to like that, but it didn't work,
> -s pics '*.jpg'
>
> I give up.
-------------------------------------------------------------------------------------------------------------------------
well it's certainly not simple. I need time to play around with it.
Needless to say nothing above actually converted the files to lowe case.
John
--
John Richard Smith
[EMAIL PROTECTED]
Want to buy your Pack or Services from MandrakeSoft?
Go to http://www.mandrakestore.com