Running bitcoind in a different directory
Make sure to stop bitcoind with bitcoin-cli stop, then move your data directory to a new folder and add the following line to your bitcoin.conf:

datadir=path/to/new/directory


This file should be somewhere in C:\Users\username\AppData\Roaming\Bitcoin\bitcoin.conf in Windows and ~/.bitcoin/bitcoin.conf in Linux.

As the user AntMor replied, you can also pass this configuration every time you run bitcoind.