I am having problems trying to create a script to rename all of the files in my directory to .txt
on Linux.
This is what I have so far.
#!/bin/bash
location_number=$(find /hw1/textarchive | wc -l)
org_path=/hw1/textarchive/!(*txt)
count=0
#for count in $location_number
#do
# rename $org_path .txt
#rename $org_path *.txt
# mv $org_path $org_path.txt
#done
for count in $location_path
do
rename $org_path .pro .txt *.pro <-----was trying to just rename .pro to .txt (no luck)
done
echo done
I tried using mv
and rename
but I got nowhere. With the mv $org_path $org_path.txt
when I run that I would get an error along the lines of (this file) is not a directory
. With rename
it would run without any error, but it would not rename any files to .txt
.
rename
commands and each works a little differently. – terdon Sep 15 '17 at 14:06