Move all files but not folders to a new folder

Hi,

I have a sub directory with a number of files and folders. What i want is a subdirectory with just folders and not files for cleanliness sake. So I want to move the files into the new folder but keep the folders in the same place. Move all files (but not folders) to new folder.

I am using the mv command, but it moves everything files and folders!!

Can someone help

Thanks

Try:

mkdir newfolder
for i in *
do
  if [ -f "$i" ]; then
    mv "$i" newfolder
  fi
done

find . -name "*" -type f -exec mv -f {} <new_dir> \;

That would move any file in any sub directory too, no? Perhaps this:

find . -path './*' -prune -type f -exec mv -f {} newfolder \;

Yes, Tks. If we need to keep files inside subfolders, then we need to use prune option.