"it won't recognize this slef-made folder" Did you add it to Matlab's search path?
On my system, R2018b,Win10, your script works as expected. (There was no directory named Users on D: in advance.)
datadir = fullfile( 'D:', 'Users', '10513345' );
cleandir = fullfile( datadir, 'data_refmast_512samplerate_71chan' );
Running the script a second time also worked as expected. i.e. did nothing.
Repacing D: by Z: (Z: doesn't exist) and running the script throws the error
The system cannot find the path specified.
Error in Untitled2 (line 5)
Did mkdir really throw the error
The system cannot find the file specified.
There is no file involved.