X-Spam-Check-By: sourceware.org To: cygwin AT cygwin DOT com From: robert_neville310 AT yahoo DOT com Subject: Renaming gotcha under FAT file system Date: Fri, 06 Apr 2007 12:31:41 -0700 Lines: 20 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com My Bash script renames file and folders from regular expression patterns found in a preset file. The patterns allow for complex renaming, yet sometimes it just converts the file name to title case. The script produces a separate file for executing the rename commands. printf "mv %-200s \"%s\"\n" "-f \"$DIR/"$FILE"\"" "$DIR"/"$NEWNAME" >> doit.sh The typical command in the doit.sh file looks like the following line. mv -f "file_to_be_rename.ext" "File_To_Be_Rename.ext" The secondary script renames hundreds of files. Twenty percent may fail do "mv" encountering the same file name (similar to the line above). Question: How do you force mv to rename a file with the same filename? The code above returns an error that the files are the same. I prefer using mv since my cygwin installation does not contain rename or mmv. Portability is very important for this script. Apparently, Wintel file systems are case insensitive, which create a problem for this script. Please give me some suggestions on dealing with this scenario. Script examples on creating a temp file or logic that appends an extra character would help me a good deal. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/