I'm glad you found my post helpful. I don't see mkdir used anywhere in your code. When you refer to mkdir, I assume you are referring to the mkpath method from Path::Tiny that you use in a couple places (not to be confused with the perl function mkdir). So, code like this may need to be changed to do what you want...
my $folder = path( $current, $to, $ts, $base_dir )->mkpath;
The documentation for the Path::Tiny mkpath
method states that it returns the list of directories created or an empty list if the directories already exist, just like make_path.
. So perhaps this would be more useful,
my $folder_path = path( $current, $to, $ts, $base_dir );
# This will print the path regardless if the path already existed or n
print "My folder path is $folder_path\n";
If you wanted to check the return value of the mkpath
method, you could store it in a scalar like this,
my $mkpath_return_value = $folder_path->mkpath;
# The value of $mkpath_return_value will be equal to the number of dir
+s created (since the return value will be a list that is forced into
# scalar context), or it will be equal to zero if the path already exi
or if you wanted the list of dirs that were created you could do this,
my @dirs = $folder_path->mkpath;