in reply to From a Newbie/help diagnosing an error opening a directory

"Can't open /tmp/folder: Not a directory at movingfilesscript.pl line 23"

The "Not a directory" error usually happens when you try to call opendir on something that exists but is... ummm... not a directory! For example, it may be a file or a FIFO or some other gubbin on the filesystem.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'