I have a directory as follows
-rw-r--r-- 1 ualaoip2 mcm1 1073233 Sep 30 12:40 database.260.4-0.tar.gz
-rw-r--r-- 1 ualaoip2 mcm1 502373963 Sep 30 12:40 database.260.4-1.tar.gz
-rw-r--r-- 1 ualaoip2 mcm1 880379753 Sep 30 12:40 database.260.4-2.tar.gz
drwxr-xr-x 2 ualaoip2 mcm1 4096 Sep 30 13:41 db0file
drwxr-xr-x 2 ualaoip2 mcm1 4096 Sep 30 13:41 db1file
drwxr-xr-x 2 ualaoip2 mcm1 4096 Sep 30 13:41 db2file
and I want to move the file database...0
into folder0
&c...
What's the best way of doing this? I tried various variants of
for i in $(ls fi*) do; mv $i ./folder$i
but they renamed things and overwrote lots of stuff I didn't want!
I tried using variants of
find . -maxdepth 1 -type d -printf '%f\n' | sort /* why is it not sorted?
but couldn't get rid of the . for the current directory.
I used mkdir db{0..7} to create the files - is this the best way?
I would appreciate a couple of words of explanation with the answer - not just a monkey see, monkey do! :-)