Multi Commander > Support and Feedback
Issue with .bat and robocopy.
Mathias (Author):
You can strip quote and trailing slash in bat script it self.
But first you need to figure out of if is the quotes OR the trailing slash or BOTH that RoboCopy do not like.
Because if you remove both and robocopy want quotes it may still not work.
Just store the the ${sourcepath} value in a bat variable first and then strip the quotes and trailing slash. and if quotes are needed then add them again
--- Code: ---SET SOURCE=${sourcepath}
rem Remove Quotes
SET SOURCE=%SOURCE:"=%
rem Remove Trailing Slash
IF %SOURCE:~-1%==\ SET SOURCE=%SOURCE:~0,-1%
rem Add quotes again (IF that are required)
SET SOURCE="%SOURCE%"
--- End code ---
Then do the same for the targetpath and then you just send the bat variables to the robocopy line as %SOURCE% and %TARGET%
nicedreams:
Doesn't work. I'm giving up on it. I'll stick to batch.
Mathias (Author):
Then you did not write it correct.
But as you have given up. I will not ask for information about what you did.
Krekkie:
Did a quick test with Robocopy:
--- Code: ---robocopy "D:\scans\" "D:\testfolder\" --> error
robocopy D:\scans\ D:\testfolder\ --> ok
robocopy "D:\scans" "D:\testfolder" --> ok
--- End code ---
So I think you better use the last one (remove trailing slash only) so that it will work with spaces in the folder names.
nicedreams:
Since there was an update to Multi Commander I went ahead and tried this again. Still doesn't work. Any other action like XCOPY or COPY or MOVE works fine though with the MC variables for some reason and don't understand why Robocopy picks this up wrong.
I don't think you are getting my point. If I try to use a variable so whatever is opened in the left and right pane of the software, it will detect that and use ROBOCOPY /MIR to mirror the contents from the right pane to the left pane. If I hard set the path in the script it works fine. It's just when I use variables inside of Multi Commander, it messes up for some reason and adds trailing slashes and quotes.
Wish it would work or if there was a fast Directory Mirror I can trust like Robocopy built inside of this software.
So again...... robocopy "D:\scans" "D:\testfolder" Works fine.
robocopy ${sourcepath} ${targetpath} Does not work
robocopy "${sourcepath}" "${targetpath}" Does not work
Using SET command to define variables, still gives same issues.
Tried all the variables and does not work, same results.
http://multicommander.com/docs/multitags
If you look at the error message below, it never has destination like it picks up ${sourcepath} ${targetpath} as the same source line. I've tried "quotes" also. When I mess with it a little bit, then the destination is there, but the formatting becomes incorrect and gives errors. It is not picking these up like if I used %appdata% and %temp% or other system variables. Is is the $DOLLAR sign in MC screwing up the variables?
Maybe author could make up something to work with Robocopy correctly? Maybe can just add a mirror function within MC that uses Robocopy and the option of mirror? Will use this program every single day if I can get this working. Will save time on modifying scripts for different tasks.
=====================================================================================
=====================================================================================
-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows
-------------------------------------------------------------------------------
Started : Sunday, July 20, 2014 11:31:37 AM
Source : D:\scans" D:\testfolder"\
Dest -
Files : *.*
Exc Dirs : AppData
Options : *.* /FFT /TEE /S /E /DCOPY:DAT /COPY:DATS /PURGE /MIR /ZB /XJ /XA:SH
/MT:8 /R:1 /W:1
------------------------------------------------------------------------------
ERROR : No Destination Directory Specified.
Simple Usage :: ROBOCOPY source destination /MIR
source :: Source Directory (drive:\path or \\server\share\path).
destination :: Destination Dir (drive:\path or \\server\share\path).
/MIR :: Mirror a complete directory tree.
For more usage information run ROBOCOPY /?
**** /MIR can DELETE files as well as copy them !
Press any key to continue . . .
=====================================================================================
=====================================================================================
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version