How to move only files in Unix

Solution 1:

You can try

find . -maxdepth 1 -type f -exec mv {} destination_path \;

Solution 2:

I'm a "use a hammer for everything" kinda guy so I use bourne shell programs for stuff others use external programs for...

for file in * .* 
do
  test -f "$file" && mv "$file" "$HOME"/
done

Some people like to get things done in as little typing as possible but I'm a pretty quick typist and I've got stuff like this built into my brain so it's not too much of a pain to do this instead of looking up the exact arguments to find and exec and all that.

YMMV, though...