What you are seeking to do is essentially this:

move the first file to a temp file: mv file1.ext /tmp/file1.ext
move the second file to the first file: mv file2.ext file1.ext
move the temp file to the second file: mv /tmp/file1.ext file2.ext

You can do this with a system call for each of the moves.  Extensions and
names won't matter, as you will be giving them the name and extension when
you do the moves.

I'd help with the code snippets, but I am in PHP mode and my perl is weak at
best...

Robert


>On Tue, 13 Apr 2004 11:53:17 -0700 "Bajaria, Praful"
<[EMAIL PROTECTED]> wrote.
>Hello,
>
>I would like to swap the file name only and not the extension or the
>content. 
>
>Example:
>There are two file : 1.jpg and 3.jpg 
>output = 1.jpg becomes 3.jpg and 3.jpg becomes 1.jpg
>
>OR
>
>1.jpg and 3.gif
>output  = 1.jpg becomes 3.jpg and 3.gif becomes 1.gif
>here we are changing the name only and not the extension.
>
>Inside my program I don't know either files extension, but they will be
only
>"jpg or gif"
>
>Any help...
>
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to