![]() GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11)Ĭopyright (C) 2007 Free Software Foundation, Inc. I am on Mac OS X, here is some relevant system info. I should be able to one-line this as the other poster has done, but no matter what I try, it doesn't work for me. If I can mv these by hand, then something is happening inside the scripts environment that is getting it confused. rw-r-r-+ 1 me staff 0 Nov 25 03:49 this is a test test.txtĪs you can see the file was renamed with lowercase just fine to "this is a test test.txt". rw-r-r-+ 1 me staff 0 Nov 25 03:49 This IS A test $mv 'This IS A test TEST.txt' 'this is a test $l The script gives me an error, but if I run these commands by hand: # "l" is an alias for ls with some args to remove fot files 'This IS A test TEST.txt' 'this is a test test.txt' I echo them out just as I would pass them as two args to the mv command. The strings are quoted in single tic marks. So I have a before and and after string of a filename, in this case, the before is the mixed case and the after is the lowercase. However, what is strange, is if I take the debugging output and manually run this, it will work fine. directoryįor some reason, mv doesn't work. Working on files in: /Users/me/Desktop/files Start run renamer.sh on Fri Nov 25 04:35: Here is what the above script will output when run. Lowercase_filename=`echo $file | tr '' ''` # Change into the directory with the files to renameĮcho "Working on files in: `pwd`" echo "" #!/bin/bashĮcho "" echo "Start run `basename $0` on `date`" For now, I am using strong quoting on everything. Learned a little about strong/weak quoting, which I thought had something to do with it. So I went about working to redo it so it would work. The trouble is, it does not work on Mac OS X. This has been answered perfectly in a previous SO question here: How do I rename all files to lowercase? You can check that the name has been changed by looking at the computer's local-network-name, which is given below the Computer Name field.After putting hours into this, I give up, and am asking for help.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |