Ubuntu – How to delete sub-folders but keep all the files

directory

I'm wondering if there's a way on Ubuntu to delete all of the subfolders in a folder but keep all the files?

Best Answer

a combination of the two answers above might work.

step 1.

find oldLocation -type f -exec mv {} newLocation \;   #find and copy all files.

step 2.

rm -frv oldLocation 

You might want to reword your questions, it's not very clear what the behavior you want is.