Results 1 to 4 of 4
Hi People,
I'm currently trying to Rename all files with .txt in a specified directory to lowercase, with this commands below:
PHP Code:
for tup in find *. txt do tup_file = ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 01-31-2012 #1
Rename all files to lowercase in a specified diretory?
Hi People,
I'm currently trying to Rename all files with .txt in a specified directory to lowercase, with this commands below:
But somehow I always get this error Message "mv 'a-z' is not a Directory" ??PHP Code:for tup in find *.txt
do
tup_file=$tup
tow_file="echo $tup | tr [A-Z] [a-z]"
mv $tup_file $tow_file
done

Thanks in Advance!
CharlesLast edited by Charles1718; 01-31-2012 at 05:14 PM. Reason: wrong spelling
- 02-01-2012 #2Just Joined!
- Join Date
- Dec 2011
- Location
- 75081
- Posts
- 16
Doing this off the top of my head, but any chance you really want to use `backticks` with your tow_file line to get the results of the output? Right now tow_file is being assigned that whole string, right?
- 02-01-2012 #3Trusted Penguin
- Join Date
- May 2011
- Posts
- 3,657
yeah, frat is right about the backticks.
also, i assume you left out the backticks on your find command in the code you posted, as it won't work as it. in any case, you don't need the find, you can more efficiently achieve the same list of txt files with a simple file glob, e.g.:
also, note that your code won't work as is if your files have white spaces in them.Code:for file in *.txt; do
- 02-02-2012 #4Just Joined!
- Join Date
- Nov 2008
- Posts
- 34
for tup in `find *.txt`; do tup_file=$tup ; tow_file=`echo $tup | tr [A-Z] [a-z]` ; mv $tup_file $tow_file ; done


Reply With Quote
