Page 1 of 1

Как сворачивать копирование в фоновый режим?

Posted: Thu 29 Oct, 2015 13:59
by unoc_u34
Доброго времени суток уважаемые форумчане! Есть такой ламерский вопрос. Подскажите пожалуйста, как можно свернуть окно "копирование", дабы продолжить работу и не ждать пока данные докопируются? Спасибо за ранее за ответы

Как сворачивать в фоновый режим?

Posted: Thu 29 Oct, 2015 16:16
by HaRT
„Искаропки“ никак, но есть плагин Background Copy — для него есть своя тема тут на форуме.

Как сворачивать копирование в фоновый режим?

Posted: Fri 30 Oct, 2015 04:55
by unoc_u34
HaRT wrote: „Искаропки“ никак, но есть плагин Background Copy — для него есть своя тема тут на форуме.
Спасибо за ответ. Такой встречный вопрос, вот подскажите пожалуйста, вообще планируются внедрить такую функцию вы не в курсе? Благодарю за ответ

Как сворачивать копирование в фоновый режим?

Posted: Thu 02 May, 2019 22:52
by klever
Hello for everyone!
I couldn't make 'Background copy (bcopy)' plugin work. That is why I wrote small script and added it to far as macros (file with script is plased in farhome directory). It's not perfect, but it's work for me. May be it will be useful for some one else.

Script "%FARHOME%\_tool_background\bcopy.bat":

Code: Select all

rem =_BACKGROUND_COPY_=

goto start
———————————————————
This batch file is 
used for starting 
copy in the background.
———————————————————
When it run, the path 
of file/directory for 
copy and the path of 
target place will be 
passed to the batch file.

example for run copy in background:
start /min /low cmd /c "%FARHOME%\_tool_background\bcopy.bat" srcObject tagregPlace
———————————————————
Batch file is written 01/05/2019
Last fix made 01/05/2019
———————————————————
:start

@echo off

rem getting paths of 'srcObject' and 'tagregPlace' 
set src_obj=%~1
set target_plc=%~2

cd\
cls
echo.
echo --------------------------------------------
echo Copy "%src_obj%"
echo to "%target_plc%"
echo started.
echo --------------------------------------------
echo.

rem getting name of 'srcObject' and placed it to the 'src_obj_name'
FOR /F "delims=|" %%A IN ("%src_obj%") do set src_obj_name=%%~nxA

rem determining: is 'srcObject' file or directory
if exist %src_obj%\ (goto :directory)
cd %src_obj% 
if "%errorlevel%"=="0" goto :directory
goto :file 

rem directory copy command
:directory
if exist %target_plc%\%src_obj_name% (goto :copydir)
mkdir %target_plc%\%src_obj_name%
:copydir
echo on
xcopy %src_obj% %target_plc%\%src_obj_name% /k /h /y /r /c /s /e
attrib -a %target_plc%\%src_obj_name%\*.* /s /d
@echo off
goto :end

rem file copy command
:file
echo.
echo JUST IN CASE: don't worry about previous message, 
echo it's just service message, every thing is under control.
echo.
echo %src_obj% is file
echo on
copy /y %src_obj% %target_plc%\%src_obj_name% 
@echo off
goto :end

:end
@echo off
echo.
echo ---------------------------------------------
echo Copy "%src_obj%"
echo to "%target_plc%"
echo finished.
echo ---------------------------------------------
echo.

Как сворачивать копирование в фоновый режим?

Posted: Fri 03 May, 2019 18:15
by klever
Sorry forgot about two things.

_FIRST_
Macros file name: "Shell_CtrlShiftF5.lua"

Macros code:

Code: Select all

Macro {
  description="";
  area="Shell"; key="CtrlShiftF5";
  flags="";
  code="Keys(\"s t a r t Space / m i n Space / l o w Space c m d Space / c Space \\\" % f a r h o m e % BackSlash _ t o o l _ b a c k g r o u n d BackSlash b c o p y . b a t \\\" Space CtrlF Tab Home CtrlF Enter CtrlR Tab\")";
}
_SECOND_
This solution is not working for cases when target (place in which is copied) is disk root directory. I don’t know how to fix it and I don’t need it (I don't often copy something to the root directory of the disk).

Как сворачивать копирование в фоновый режим?

Posted: Sat 04 May, 2019 15:31
by klever
Other version of script "%FARHOME%\_tool_background\bcopy.bat":

Code: Select all

rem =_BACKGROUND_COPY_=

goto start
-------------------
This batch file is 
used for starting 
copy in the background.
-------------------
When it run, the path 
of file/directory for 
copy and the path of 
target place will be 
passed to the batch file.

example for run copy in background:
start /min /low cmd /c "%FARHOME%\_tool_background\bcopy.bat" srcObject tagregPlace
-------------------
Batch file is written 01/05/2019
Last fix made 04/05/2019
-------------------
:start

@echo off

rem getting paths of 'srcObject' and 'tagregPlace' 
set src_obj=%~1
set target_plc=%~2

cd\
cls
echo.
echo --------------------------------------------
echo Copy "%src_obj%"
echo to "%target_plc%"
echo started.
echo --------------------------------------------
echo.

rem getting name of 'srcObject' and placed it to the 'src_obj_name'
FOR /F "delims=|" %%A IN ("%src_obj%") do set src_obj_name=%%~nxA

rem determining: is 'srcObject' file or directory
cd "%src_obj%"
if "%errorlevel%"=="0" goto :directory
goto :file 

rem directory copy command
:directory
if exist "%target_plc%\%src_obj_name%" (goto :copydir)
mkdir "%target_plc%\%src_obj_name%"
:copydir
echo on
robocopy "%src_obj%" "%target_plc%\%src_obj_name%" /e /z /eta /R:2 /W:5
@echo off
goto :end

rem file copy command
:file
echo.
echo JUST IN CASE: don't worry about previous message, 
echo it's just service message, every thing is under control.
echo.
rem saved this code just in case
rem 'copy' do not work with hidden and system files
rem copy /y "%src_obj%" "%target_plc%\%src_obj_name%" 
rem
rem 'echo f' here for answer to the request is a file or directory
echo on
echo f | xcopy "%src_obj%" "%target_plc%\%src_obj_name%" /k /h /y /r /c /s /e
attrib -a "%target_plc%\%src_obj_name%"
@echo off
goto :end

:end
@echo off
echo.
echo ---------------------------------------------
echo Copy "%src_obj%"
echo to "%target_plc%"
echo finished.
echo ---------------------------------------------
echo.

Как сворачивать копирование в фоновый режим?

Posted: Wed 08 May, 2019 20:53
by klever
Fixed work for paths with spaces.

Macros file name: "Shell_CtrlShiftF5.lua"
Macros code:

Code: Select all

Macro {
  description="";
  area="Shell"; key="CtrlShiftF5";
  flags="";
  code="Keys(\"s t a r t Space \\\"\\\" Space / m i n Space / l o w Space c a l l Space \\\" % f a r h o m e % BackSlash _ t o o l _ b a c k g r o u n d BackSlash b c o p y . b a t \\\" Space CtrlF Tab Home CtrlF Enter CtrlR Tab\")";
}
Script "%FARHOME%\_tool_background\bcopy.bat":

Code: Select all

rem =_BACKGROUND_COPY_=

goto start
-------------------
This batch file is 
used for starting 
copy in the background.
-------------------
When it run, the path 
of file/directory for 
copy and the path of 
target place will be 
passed to the batch file.

example for run copy in background:
start "" /min /low call "%FARHOME%\_tool_background\bcopy.bat" srcObject tagregPlace
-------------------
Batch file is written 01/05/2019
Last fix made 08/05/2019
-------------------
:start

@echo off

rem getting paths of 'srcObject' and 'tagregPlace' 
set src_obj=%~1
set target_plc=%~2

cd\
cls
echo.
echo --------------------------------------------
echo Copy "%src_obj%"
echo to "%target_plc%"
echo started.
echo --------------------------------------------
echo.

rem getting name of 'srcObject' and placed it to the 'src_obj_name'
FOR /F "delims=|" %%A IN ("%src_obj%") do set src_obj_name=%%~nxA

rem determining: is 'srcObject' file or directory
cd "%src_obj%"
if "%errorlevel%"=="0" goto :directory
goto :file 

rem directory copy command
:directory
if exist "%target_plc%\%src_obj_name%" (goto :copydir)
mkdir "%target_plc%\%src_obj_name%"
:copydir
echo on
robocopy "%src_obj%" "%target_plc%\%src_obj_name%" /e /z /eta /R:2 /W:5
@echo off
goto :end

rem file copy command
:file
echo.
echo JUST IN CASE: don't worry about previous message, 
echo it's just service message, every thing is under control.
echo.
rem saved this code just in case
rem 'copy' do not work with hidden and system files
rem copy /y "%src_obj%" "%target_plc%\%src_obj_name%" 
rem
rem 'echo f' here for answer to the request is a file or directory
echo on
echo f | xcopy "%src_obj%" "%target_plc%\%src_obj_name%" /k /h /y /r /c /s /e
attrib -a "%target_plc%\%src_obj_name%"
@echo off
goto :end

:end
@echo off
echo.
echo ---------------------------------------------
echo Copy "%src_obj%"
echo to "%target_plc%"
echo finished.
echo ---------------------------------------------
echo.

ping -n 5 localhost > nul

exit