0

Using Windows 10 if possible, I'd like to be able to send from my local host to my git development path using the Send To context menu.

(Win + R, shell:sendto)

I have two directories lets say they are:

C:\wamp\www\projectname
C:\Users\myname\projectname

Now lets say I've updated a file deep in my localhost directory e.g.

C:\wamp\www\projectname\application\libraries\js\jsfile.js

I'd like to be able to right click that file > Send to

Dev root path: (C:\Users\myname\projectname) append file path (\application\libraries\js\jsfile.js)

So essentially it's sending the file to the same folder, just in a different directory.

I can get some of the path using:

for /f %%q in ("%~dp0.") do echo C:\Users\myname\projectname\%%~nxq

I'd need to get all folders after \projectname\ and that could be 1 or 10 different folders.

I realize this a lot to ask but I think this could be useful for many people.

2
  • Would you like to do this with all files in C:\wamp\www\projectname\application\ or just the ones you right click + send to ? Cause if you want all you could use robocopy Source Destiny /e that would automatically create all subfolders that do not exist in the destiny... Commented Feb 28, 2022 at 7:12
  • Just the selected files
    – noname
    Commented Feb 28, 2022 at 7:49

1 Answer 1

1

Would this be as expected:

enter image description here

My Project.bat:

@echo off

set Destiny=%userprofile%\projectname
set PartToIgnore=\wamp\www\projectname\application\

IF /i not exist "%Destiny%" md "%Destiny%"

for %%a in (%*) do call :MoveFiles "%%~a"
exit

:MoveFiles
set SourceFile=
set RelativeSource=
set "SourceFile=%~pnx1"
call set "RelativeSource=%%SourceFile:%PartToIgnore%=%%"
echo F | xcopy /i /h /y "%~1" "%Destiny%\%RelativeSource%"
goto :EOF
1
  • Amazing, you just made my life much easier! Thank you.
    – noname
    Commented Mar 1, 2022 at 1:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .