zsh-users
 help / color / mirror / code / Atom feed
* zmv another zsh gem
@ 2005-02-15  8:51 zzapper
  2005-02-15 11:06 ` Christian Taylor
  0 siblings, 1 reply; 5+ messages in thread
From: zzapper @ 2005-02-15  8:51 UTC (permalink / raw)
  To: zsh-users

Hi,
In comp.editors I came across mmv and zmv

# zmv "programmable rename"
# Replace spaces in filenames with a underline
zmv '* *' '$f:gs/ /_'
# Change the suffix from *.sh to *.pl
zmv -W '*.sh' '*.pl'
# lowercase/uppercase all files/directories
$ zmv '(*)' '${(L)1}' # lowercase
$ zmv '(*)' '${(U)1}' # uppercase

The case changers don't work on Cygwin because WinXP grumbles target & source filename are the same!
zzapper (vim, cygwin, wiki & zsh)
--

vim -c ":%s%s*%CyrnfrTfcbafbeROenzSZbbyranne%|:%s)[R-T]) )Ig|:norm G1VGg?"

http://www.vim.org/tips/tip.php?tip_id=305  Best of Vim Tips


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: zmv another zsh gem
  2005-02-15  8:51 zmv another zsh gem zzapper
@ 2005-02-15 11:06 ` Christian Taylor
  2005-02-15 21:05   ` Seth Kurtzberg
  2005-02-17 19:02   ` Peter Stephenson
  0 siblings, 2 replies; 5+ messages in thread
From: Christian Taylor @ 2005-02-15 11:06 UTC (permalink / raw)
  To: zsh-users

On Tuesday 15 February 2005 09:51, zzapper wrote:

> In comp.editors I came across mmv and zmv
> [...]
> The case changers don't work on Cygwin because WinXP grumbles target &
> source filename are the same!

Using mv to change the case of a filename doesn't work on any "caseless" file 
system like vfat, because both filenames refer to the same, existing file. 
Afaik POSIX compliance demands an error in that case. You'll have to do it in 
two steps.

Christian Taylor


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: zmv another zsh gem
  2005-02-15 11:06 ` Christian Taylor
@ 2005-02-15 21:05   ` Seth Kurtzberg
  2005-02-17 19:02   ` Peter Stephenson
  1 sibling, 0 replies; 5+ messages in thread
From: Seth Kurtzberg @ 2005-02-15 21:05 UTC (permalink / raw)
  To: zsh-users

Christian Taylor wrote:

>On Tuesday 15 February 2005 09:51, zzapper wrote:
>
>  
>
>>In comp.editors I came across mmv and zmv
>>[...]
>>The case changers don't work on Cygwin because WinXP grumbles target &
>>source filename are the same!
>>    
>>
>
>Using mv to change the case of a filename doesn't work on any "caseless" file 
>system like vfat, because both filenames refer to the same, existing file. 
>Afaik POSIX compliance demands an error in that case. You'll have to do it in 
>two steps.
>  
>
That would make sense if cygwin were, in general, POSIX compliant and 
similarly if cygwin treated the mixed case file system as a mixed case 
file system.

That is, however, not the case.  In fact cygwin is all over the map.  If 
you have a file named Filename, and, say, do "vi file<tab>", Filename 
will not appear.  Cygwin more or less wraps the file system in an 
attempt to make the observed behavior as close as possible to a typical 
UNIX case sensitive file system.  This layer does many things that 
cannot be done in the native file system.  For example, it maintains 
pseudo-permissions, and you cannot, say, do something like ./filename 
(to run it), unless it has the x pseudo-permission.  It even does fake 
symbolic links.

I'm not saying it is worth the effort to muck around with the code to 
treat cygwin as a special case.  I'm just pointing out that the reason 
is not because it violates POSIX, because cygwin is miles away from 
being POSIX compliant.

>Christian Taylor
>
>!DSPAM:4211dbf2255221178510702!
>
>  
>
   


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: zmv another zsh gem
  2005-02-15 11:06 ` Christian Taylor
  2005-02-15 21:05   ` Seth Kurtzberg
@ 2005-02-17 19:02   ` Peter Stephenson
  2005-02-21 17:08     ` zzapper
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Stephenson @ 2005-02-17 19:02 UTC (permalink / raw)
  To: zsh-users

Christian Taylor wrote:
> On Tuesday 15 February 2005 09:51, zzapper wrote:
> 
> > In comp.editors I came across mmv and zmv
> > [...]
> > The case changers don't work on Cygwin because WinXP grumbles target &
> > source filename are the same!
> 
> Using mv to change the case of a filename doesn't work on any "caseless" file
>  
> system like vfat, because both filenames refer to the same, existing file. 
> Afaik POSIX compliance demands an error in that case. You'll have to do it in
>  
> two steps.

Now I remember, zmv even warns you about this:

% zmv foobar Foobar
zmv: error(s) in substitution:
file exists: Foobar
(Probably the same file, owing to file system limitations.)


-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

**********************************************************************


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: zmv another zsh gem
  2005-02-17 19:02   ` Peter Stephenson
@ 2005-02-21 17:08     ` zzapper
  0 siblings, 0 replies; 5+ messages in thread
From: zzapper @ 2005-02-21 17:08 UTC (permalink / raw)
  To: zsh-users

On Thu, 17 Feb 2005 19:02:44 +0000,  wrote:

>Christian Taylor wrote:
>> On Tuesday 15 February 2005 09:51, zzapper wrote:
>> 
>> > In comp.editors I came across mmv and zmv
>> > [...]
>> > The case changers don't work on Cygwin because WinXP grumbles target &
>> > source filename are the same!
>> 
>> Using mv to change the case of a filename doesn't work on any "caseless" file
>>  
>> system like vfat, because both filenames refer to the same, existing file. 
>> Afaik POSIX compliance demands an error in that case. You'll have to do it in
>>  
>> two steps.
>
>Now I remember, zmv even warns you about this:
>
>% zmv foobar Foobar
>zmv: error(s) in substitution:
>file exists: Foobar
>(Probably the same file, owing to file system limitations.)
A work around is:-

zmv '(*~low)' low/'${(L)1}' #lowercase to subdirectory

which has the advantage of giving you a second chance if you get it wrong

zzapper (vim, cygwin, wiki & zsh)
--

vim -c ":%s%s*%CyrnfrTfcbafbeROenzSZbbyranne%|:%s)[R-T]) )Ig|:norm G1VGg?"

http://www.vim.org/tips/tip.php?tip_id=305  Best of Vim Tips


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-02-21 17:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-15  8:51 zmv another zsh gem zzapper
2005-02-15 11:06 ` Christian Taylor
2005-02-15 21:05   ` Seth Kurtzberg
2005-02-17 19:02   ` Peter Stephenson
2005-02-21 17:08     ` zzapper

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).