Replace file name
Hi,
I am having a files in my directory like this: Code:
2014 1049_file1.txt Code:
file1.txt Code:
for i in *.txt |
since you have stupid spaces in your original filenames maybe you need to put quotes around them so that the shell can interpret them correctly (what is the error you are getting -- file not found ?) ?
there is prolly a better way but this is my quick-and-dirty hax with awk[untested]: Code:
for i in *.txt |
Hi,
the above didn't work its giving error and moreover my code gave error like -bash: ${*_i}: bad substitution |
Code:
for i in *.txt; do |
My 2 cents
Another way to remove spaces in filenames in a folder Code:
for i in *.txt; do mv "$i" ${i// /}; done Code:
for i in *.txt; do mv $i $(echo $i | sed 's .\{10\} '); done Code:
for i in *.txt; do mv $i $(echo $i | cut -c 10-); done |
Quote:
Code:
for i in *.txt; do mv "$i" "${i:10}"; done |
Quote:
|
All times are GMT -5. The time now is 01:21 AM. |