find . -path ./upld -prune -o ! -path . -print
This would use find
to delete everything from the current directory, including subdirectories. However, the path ./upld
is not deleted (note that this must be the full relative path of the thing you want to skip, from the initial search path).
Run this and check the output, then replace -print
by -delete
.
The safe option, from the parent of the directory in question:
mkdir newdir
mv olddir/upld newdir
rm -rf olddir
mv newdir olddir
That is, move the upld
subdirectory out of the way for safe-keeping, then delete the old directory completely.