Hi Guys,
I have to rename about 180 files in different folders in linux. For example,
abc_110117.txt
eff_110117.txt
zzz_110117.txt
After renaming the files, these files should like like
abc.txt
eff.txt
zzz.txt
I created a small script to rename the files like
ls $COMP_FILE_DIR/*.txt > $COMP_FILE_DIR/change_file_name.txt
while read line
do
FILE=$(echo $line | cut -f1 -d\_)
FILE_NAME=$(echo $FILE'.txt')
mv $line $FILE_NAME
done < $COMP_FILE_DIR/change_file_name.txt
rm $COMP_FILE_DIR/change_file_name.txt
But because of time contraints and using different folders, I have to spend too much time to rename the files.
Is there one command that I can run to rename the files.
Thanks a lot.
Naveed