Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: zmv warning

I tried to rename a file to lower case using zmv and it told me the file
already existed.  Eventually I realised this was because the file system
was a Samba partition and the two referred to the same file.  It's a
real error in that the final mv command gives the same error, but it
could do with a better message.

Actually, it should be possible to do this via an intermediate file,
since Samba does show you the file in the canonical form even though it
recognises it with case changes.  However, that's too hard for now.

This was entirely on Unix but I imagine similar things happen with
Cygwin.  (Yes, I would prefer to use NFS.)

Index: Functions/Misc/zmv
RCS file: /cvsroot/zsh/zsh/Functions/Misc/zmv,v
retrieving revision 1.10
diff -u -r1.10 zmv
--- Functions/Misc/zmv	30 Mar 2002 19:30:11 -0000	1.10
+++ Functions/Misc/zmv	16 Jan 2004 14:35:06 -0000
@@ -263,7 +263,12 @@
   elif [[ -n $from[$g] && ! -d $g ]]; then
     errs=($errs "$f and $from[$g] both map to $g")
   elif [[ -f $g && -z $opt_f ]]; then
-    errs=($errs "file exists: $g")
+    if [[ $f != $g && $f -ef $g ]]; then
+      errs=($errs "file exists: $g
+(Probably the same file, owing to file system limitations.)")
+    else
+      errs=($errs "file exists: $g")
+    fi

Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, 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.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.


Messages sorted by: Reverse Date, Date, Thread, Author