Reputation: 1507
I need make multiple folder having the name from file without extension with this command
for i in *.avi; do mkdir "${i%.*}"; done
I don't know how to mv the related file in the folder made...
Thanks for any help
Thanks. Let's say I want to do a general script to record on Textexpander which ask me for the file extension a sort of this :
echo "Type the suffix of the file follewe by enter:"
read ext
for i in *.ext
do
mkdir "${i%.ext}"
mv "$i" "${i%.ext}"
done
But this is not working.
Upvotes: 0
Views: 68
Reputation: 274612
Use the mv
command:
for i in *.avi
do
mkdir "${i%.*}"
mv "$i" "${i%.*}"
done
Upvotes: 3