GChuf / RCWM

Right Click Windows Magic is an open-source set of right-click (context) menu tools for admins, power users and other magic beings. Batch&Powershell.
GNU General Public License v3.0
102 stars 9 forks source link

UNC Paths are an issue #9

Closed Dilogoat closed 1 year ago

Dilogoat commented 2 years ago

Excellent suite of tools - very very helpful for my general day to day.

Query though - When moving a local to UNC or UNC to UNC the command window states that it doesn not support UNC paths. I have my own Robocopy script that i have been using for years to move from local to UNC or UNC to UNC depending on use case. I cannot see any material difference in how the Robopcopy command functions but it always moves the folder to C:\Windows\$folder.

My own script is this:

@ECHO OFF :: Source input SET /p "src=Please enter source: " SET "casep=%SRC%"

:: SET "casef=%casep:~0,-1%" (IF ENDS IN ) for %%f in (%casep%) do set myfolder=%%~nxf

:: Destination input SET /p dest=Please enter destination: SET dests=%dest:"=% SET "dests=%dests%\%myfolder%" MKDIR "%dests%"

:: LOG Directory ECHO LOG will go to root of destination. ECHO Press any key to continue ECHO ========================== pause :: MOVE Command c:\windows\system32\robocopy.exe %src% "%dests%" /MOVE /E /MT:8 /R:1 /W:5 /COPY:da /TEE /NP /LOG:"%dests%\MOVELog.log"

:: Check source folder is empty before removing it DIR /b /a %SRC% | >nul findstr "^" && (echo Files and/or Folders exist) || (echo No File or Folder found) pause

GChuf commented 2 years ago

Hey, thanks for opening this issue and your feedback!

If I understand correctly, my script copies the folder to your local C:\Windows instead of the actual UNC path? I'll have to test it, it could be the backslashes that are causing the problem. Are you using single or multiple mode? Which windows (or powershell) version? Which RCWM version?

I'm in the process of moving everything to powershell and using registry for storing filepaths, so single mode and multiple mode will both use the same script. Should be a bit easier to debug and maintain.

Dilogoat commented 2 years ago

Correct, C:\Windows[folder]. The above script I shared with you appears to effectively run it the same way and it works when I run it. PS would be a nice move as well. Thanks for looking into it.

GChuf commented 2 years ago

I was able to reproduce, this should be fixed when the scripts move to powershell. Since batch script can't "cd" into the UNC path, it can't get the name of the source folder - it mistakenly takes the destination folder's name instead.

GChuf commented 1 year ago

This should be resolved for copying/moving and removing directories in v2.0.0 (making links will still fail). Try it out: https://github.com/GChuf/RCWM/releases/tag/v2.0.0

Dilogoat commented 1 year ago

Excellent! Giving it a shot now.

On Sun, 26 Mar 2023 at 17:53, Chuf @.***> wrote:

This should be resolved for copying/moving and removing directories in v2.0.0 (making links will still fail). Try it out: https://github.com/GChuf/RCWM/releases/tag/v2.0.0

— Reply to this email directly, view it on GitHub https://github.com/GChuf/RCWM/issues/9#issuecomment-1484156201, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANAYYRBNE443A4345KDT4O3W6B7B3ANCNFSM5ZXSINVA . You are receiving this because you authored the thread.Message ID: @.***>

-- Regards,

Jonathan Flood