Specific detail with the move funcionality
Moderators: Hacker, petermad, Stefan2, white
-
- Junior Member
- Posts: 5
- Joined: 2013-01-24, 16:27 UTC
Specific detail with the move funcionality
I have the nest situation:
I get files organized into 20 folders from an external process. These folders must exist to receive the files.
I need to move the files in those folders elsewhere (a hard disc). To do this I use the function "Move". But with it also takes the 20 folders (disappears). If the external process is sending files when thera are no folders, files are lost.
How I can move all the files in the folders, preserving the source folders, files ready for more?
I get files organized into 20 folders from an external process. These folders must exist to receive the files.
I need to move the files in those folders elsewhere (a hard disc). To do this I use the function "Move". But with it also takes the 20 folders (disappears). If the external process is sending files when thera are no folders, files are lost.
How I can move all the files in the folders, preserving the source folders, files ready for more?
Jose
- sqa_wizard
- Power Member
- Posts: 3897
- Joined: 2003-02-06, 11:41 UTC
- Location: Germany
- sqa_wizard
- Power Member
- Posts: 3897
- Joined: 2003-02-06, 11:41 UTC
- Location: Germany
-
- Junior Member
- Posts: 5
- Joined: 2013-01-24, 16:27 UTC
Just select this 20 folders and press Shift-Ctrl-B.
=> This will show all files plain (without folders).
Now select required files (ALT-A for all) and press F6 to move.
=> Files are moved, folders remain.
===============
I'm doing that and remove the folders in the origin.
What is "TreeCopyPlus" ?
I appreciate any help on it...
=> This will show all files plain (without folders).
Now select required files (ALT-A for all) and press F6 to move.
=> Files are moved, folders remain.
===============
I'm doing that and remove the folders in the origin.
What is "TreeCopyPlus" ?
I appreciate any help on it...
Jose
- sqa_wizard
- Power Member
- Posts: 3897
- Joined: 2003-02-06, 11:41 UTC
- Location: Germany
It is a packer plugin TreeCopyPlus.What is "TreeCopyPlus" ?
Just install it by doubleclick. (assign extension = "TreeCopyPlus" just to identify it).
You will need to:
- select files
- press Alt+F5
- select Packer=TreeCopyPlus
- tick option "Move to archive"
- finally click OK.
It will copy/move files (not pack) keeping folder structure.
#5767 Personal license
-
- Junior Member
- Posts: 5
- Joined: 2013-01-24, 16:27 UTC
sqa_wizard wrote:It is a packer plugin [].What is "TreeCopyPlus" ?
Just install it by doubleclick. (assign extension = "TreeCopyPlus" just to identify it).
You will need to:
- select files
- press Alt+F5
- select Packer=TreeCopyPlus
- tick option "Move to archive"
- finally click OK.
It will copy/move files (not pack) keeping folder structure.
Nop... "TreeCopyPlus" delete the original folders too.

Jose
- sqa_wizard
- Power Member
- Posts: 3897
- Joined: 2003-02-06, 11:41 UTC
- Location: Germany
Re: Specific detail with the move funcionality
This behavior for move function in Total Commander is normal, the move function is conceptually similar to the cut & paste function of Windows: you select a thing, that can be a folder containing some files and subfolders or a single file, and it is transferred completely to destination.pepeok_2000 wrote:I have the nest situation:
I get files organized into 20 folders from an external process. These folders must exist to receive the files.
I need to move the files in those folders elsewhere (a hard disc). To do this I use the function "Move". But with it also takes the 20 folders (disappears). If the external process is sending files when thera are no folders, files are lost.
How I can move all the files in the folders, preserving the source folders, files ready for more?
So, the operation that you want to do is rather different.
I have made a bat script that does the function you requested, follow my indications:
1- Made in the TC folder (c:\totalcmd) a file named: MoveFilesMaintainTree.bat
Edit that file and copy & paste the following code:
Code: Select all
@echo off
IF %1 == NUL GOTO lowmemory
IF %2 == NUL GOTO lowmemory
set SOURCE=%1
set DESTINATION=%2
:UP_1
echo Source folder = %SOURCE%
echo Destination folder = %DESTINATION%
echo.
echo Are folders correct? (y/n)
set /P CONFIRM=
if %CONFIRM% == Y GOTO continue
if %CONFIRM% == y GOTO continue
if %CONFIRM% == N GOTO abort
if %CONFIRM% == n GOTO abort
cls & GOTO UP_1
:continue
echo.
echo Execution of copy process:
cd %SOURCE%
xcopy *.* %DESTINATION% /-Y /Q /H /G /X /K /E
if errorlevel 5 goto diskerror
if errorlevel 4 goto lowmemory
if errorlevel 2 goto abort
if errorlevel 1 goto foundanything
if errorlevel 0 GOTO OK
:diskerror
echo.
echo Disk write error occurred.
goto ERROR
:lowmemory
echo.
echo Insufficient memory to copy files or
echo invalid drive or command-line syntax.
goto ERROR
:abort
echo.
echo You pressed CTRL+C to end the copy operation.
echo Or you have interrupted the script by answering NO to a question.
goto ERROR
:foundanything
echo.
echo No files were found to copy.
goto ERROR
:OK
echo.
echo Files are copied all successfully in %DESTINATION%!
echo.
:UP_2
echo Now you can delete files in source folder but maintaining folder tree.
echo Are you sure you want to delete ALL files in %SOURCE%? (y/n)
set /P ANSWER=
if %ANSWER% == Y GOTO proceed
if %ANSWER% == y GOTO proceed
if %ANSWER% == N GOTO abort
if %ANSWER% == n GOTO abort
cls & GOTO UP_2
:proceed
del /F /S /Q %SOURCE% > NUL
echo.
echo All files in the source folder have been deleted!
:ERROR
echo.
echo Press any key to close this window.
pause>NUL
Create a file named like this: usercmd.ini
And then copy & paste in it the following strings:
If already exists, edit and add the above strings.[em_MoveFilesMaintainTree]
button=C:\Windows\System32\shell32.dll,2
cmd=""C:\totalcmd\MoveFilesMaintainTree.bat""
param="param=P%S %T%R"
3- Remain in %APPDATA%\GHISLER and edit: wincmd.ini
search shorcuts section and copy & paste this string:
If you don't find shortcuts section, copy & paste these second strings instead of the first string:F12=em_MoveFilesMaintainTree
This procedure works only if in the install procedure of the program (Total Commander), you haven't changed the paths that I have mentioned before.[Shortcuts]
F12=em_MoveFilesMaintainTree
Use of the bat script:
1- select target folder where put the files in left or right file windows of TC.
2- go in the source folder that contains the folder of your interest in left or right file windows of TC. Remember: the selected file window is the source folder.
3- press F12 button on keyboard - you can define another keystroke if you want or you can make an icon of the command in the Button Bar - and follow the instructions on the screen.
For security and testing reason, try the bat script initially with unimportant files. I have tested it but for be sure it's better to try it for don't risking to losing precious files accidentally.
I hope this script is useful for you.
edit 1: I have just found a problem, if the paths of source or destination folders are too long the script doesn't work. This depends on the limits of these parameters:
I don't know if is possible to add compatibility for the long names for paths.param="%P %T"
edit 2: By reading more closely the guide of TC, I have found the solution for the handling of long names for paths.
The new parameters are:
I have already updated/corrected the code of the bat script and the parameters in the description of usercmd.iniparam=P%S %T%R
Now the script works in the way that I have thought.
edit 3: correction in bat script:
del /F /S /Q %SOURCE% *.* ---> del /F /S /Q %SOURCE%
I almost forgot, I'm using Windows 7 and TC 8.1 both 64-bit. I think that this script and the other instructions are compatible with Windows XP or with newer M$'s Operating systems and for TC type 32 bit.
edit 4: Added control of the user input. If you respond with wrong letters or words to a question, question will be reformulated:
A similar thing is been done for the ANSWER variable.@echo off
IF %1 == NUL GOTO lowmemory
IF %2 == NUL GOTO lowmemory
::IF %1 == "" GOTO lowmemory
::IF %2 == "" GOTO lowmemory
set SOURCE=%1
set DESTINATION=%2
:UP_1
echo Source folder = %SOURCE%
echo Destination folder = %DESTINATION%
echo.
echo Are folders correct? (y/n)
set /P CONFIRM=
if %CONFIRM% == Y GOTO continue
if %CONFIRM% == y GOTO continue
if %CONFIRM% == N GOTO abort
if %CONFIRM% == n GOTO abort
cls & GOTO UP_1
:continue
echo.
echo Execution of copy process:
cd %SOURCE%
xcopy *.* %DESTINATION% /-Y /Q /H /G /X /K /E
if errorlevel 5 goto diskerror
if errorlevel 4 goto lowmemory
if errorlevel 2 goto abort
if errorlevel 1 goto foundanything
if errorlevel 0 GOTO OK
:diskerror
echo.
echo Disk write error occurred.
goto ERROR
:lowmemory
echo.
echo Insufficient memory to copy files or
echo invalid drive or command-line syntax.
goto ERROR
:abort
echo.
echo You pressed CTRL+C to end the copy operation.
echo Or you have interrupted the script by answering NO to a question.
goto ERROR
:foundanything
echo.
echo No files were found to copy.
goto ERROR
:OK
echo.
echo Files are copied all successfully in %DESTINATION%!
echo.
:UP_2
echo Now you can delete files in source folder but maintaining folder tree.
echo Are you sure you want to delete ALL files in %SOURCE%? (y/n)
set /P ANSWER=
if %ANSWER% == Y GOTO proceed
if %ANSWER% == y GOTO proceed
if %ANSWER% == N GOTO abort
if %ANSWER% == n GOTO abort
cls & GOTO UP_2
:proceed
del /F /S /Q %SOURCE% > NUL
echo.
echo All files in the source folder have been deleted!
:ERROR
echo.
echo Press any key to close this window.
pause>NUL
edit 5: Edit of the code for deleting files:
edit 6: various optimizations to bat script.del /F /S /Q %SOURCE% > NUL
echo.
echo All files in the source folder have been deleted!