anchor.diff:              CommonProvidersSet = ordsets:intersection(TargetProvidersSet, SourceProvidersSet),
               case ordsets:is_element(oneprovider:get_provider_id(), CommonProvidersSet) of
                   true ->
  -                    rename_interspace(CTX, SourceEntry, LogicalTargetPath);
  +                    case FileType of
  +                        ?REGULAR_FILE_TYPE ->
  +                            rename_file_interspace(CTX, SourceEntry, LogicalTargetPath);
  +                        ?DIRECTORY_TYPE ->
  +                            rename_dir_interspace(CTX, SourceEntry, LogicalTargetPath)
  +                    end;
                   false ->
                       rename_interprovider(CTX, SourceEntry, LogicalTargetPath)
               end
       end.
   
   %%--------------------------------------------------------------------
  +%% @doc Checks permissions before renaming regular file within one space.
  +%%--------------------------------------------------------------------
  +-spec rename_file_trivial(fslogic_worker:ctx(), fslogic_worker:file(),
  +    file_meta:path()) -> ok | logical_file_manager:error_reply().
  +-check_permissions([{traverse_ancestors, {path, 3}}, {?add_object, {parent, {path, 3}}}]).
  +rename_file_trivial(CTX, SourceEntry, LogicalTargetPath) ->
  +    rename_trivial(CTX, SourceEntry, LogicalTargetPath).
  +
  +%%--------------------------------------------------------------------
  +%% @doc Checks permissions before renaming directory within one space.
  +%%--------------------------------------------------------------------
  +-spec rename_dir_trivial(fslogic_worker:ctx(), fslogic_worker:file(),
  +    file_meta:path()) -> ok | logical_file_manager:error_reply().
  +-check_permissions([{traverse_ancestors, {path, 3}}, {?add_subcontainer, {parent, {path, 3}}}]).
  +rename_dir_trivial(CTX, SourceEntry, LogicalTargetPath) ->
  +    rename_trivial(CTX, SourceEntry, LogicalTargetPath).
  +
  +%%--------------------------------------------------------------------
   %% @doc Renames file within one space.
   %%--------------------------------------------------------------------
   -spec rename_trivial(fslogic_worker:ctx(), fslogic_worker:file(),
       file_meta:path()) -> ok | logical_file_manager:error_reply().
   rename_trivial(CTX, SourceEntry, LogicalTargetPath) ->
  +    rename_interspace(CTX, SourceEntry, LogicalTargetPath).
  +
  +
  +%%--------------------------------------------------------------------
  +%% @doc Checks permissions before renaming regular file within one provider.
  +%%--------------------------------------------------------------------
  +-spec rename_file_interspace(fslogic_worker:ctx(), fslogic_worker:file(),
  +    file_meta:path()) -> ok | logical_file_manager:error_reply().
  +-check_permissions([{traverse_ancestors, {path, 3}}, {?add_object, {parent, {path, 3}}}]).
  +rename_file_interspace(CTX, SourceEntry, LogicalTargetPath) ->
  +    rename_interspace(CTX, SourceEntry, LogicalTargetPath).
  +
  +%%--------------------------------------------------------------------
  +%% @doc Checks permissions before renaming directory within one provider.
  +%%--------------------------------------------------------------------
  +-spec rename_dir_interspace(fslogic_worker:ctx(), fslogic_worker:file(),
  +    file_meta:path()) -> ok | logical_file_manager:error_reply().
  +-check_permissions([{traverse_ancestors, {path, 3}}, {?add_subcontainer, {parent, {path, 3}}}]).
  +rename_dir_interspace(CTX, SourceEntry, LogicalTargetPath) ->
       rename_interspace(CTX, SourceEntry, LogicalTargetPath).
   
   %%--------------------------------------------------------------------
  
positive.code: %%--------------------------------------------------------------------
  -spec rename_select(CTX :: fslogic_worker:ctx(), SourceEntry :: fslogic_worker:file(),
      CanonicalTargetPath :: file_meta:path(),
      LogicalTargetPath :: file_meta:path()) ->
      ok | logical_file_manager:error_reply().
  rename_select(CTX, SourceEntry, CanonicalTargetPath, LogicalTargetPath) ->
      {_, TargetParentPath} = fslogic_path:basename_and_parent(CanonicalTargetPath),
      {ok, #document{key = SourceUUID}} = file_meta:get(SourceEntry),
      SourceSpaceId = fslogic_spaces:get_space_id(SourceUUID),
  
negative.code: 
              case Doc of
                  #document{value = #file_meta{type = ?REGULAR_FILE_TYPE}} ->
                      {ok, TargetGuid} = logical_file_manager:create(SessId, NewPath, 8#777),
                      ok = copy_file_contents(SessId, {guid, SourceGuid}, {guid, TargetGuid});
  
                  #document{value = #file_meta{type = ?DIRECTORY_TYPE}} ->
                      {ok, TargetGuid} = logical_file_manager:mkdir(SessId, NewPath, 8#777)
              end,
              {guid, TargetGuid}
          end,
          fun(#document{key = SourceUuid, value = #file_meta{atime = ATime,
              mtime = MTime, ctime = CTime, mode = Mode}} = Doc, Target) ->
              SourceGuid = fslogic_uuid:to_file_guid(SourceUuid),
              ok = logical_file_manager:set_perms(SessId, Target, Mode),
              ok = logical_file_manager:update_times(SessId, Target, ATime, MTime, CTime),
              ok = copy_file_attributes(SessId, {guid, SourceGuid}, Target),
              case Doc of
                  #document{value = #file_meta{type = ?REGULAR_FILE_TYPE}} ->
                      ok = logical_file_manager:unlink(SessId, {guid, SourceGuid});
  
                  #document{value = #file_meta{type = ?DIRECTORY_TYPE}} ->
                      ok = logical_file_manager:rmdir(SessId, {guid, SourceGuid})
              end
          end),
  
      CurrTime = erlang:system_time(seconds),
  