Copy multiple folders with files without subfolders
Moderators: Hacker, petermad, Stefan2, white
Copy multiple folders with files without subfolders
Hi to all.
is there a way to copy files (even if they are contained in subfolders) without the folder structure, manteining each parent folder?
For example I have a folder called "DEEP PURPLE IN ROCK" that contains a subfolder called "MEDIA" and inside the subfolder there are files like image.cue and image.flac
I would like to copy only the folder "DEEP PURPLE IN ROCK" and the two files without maintaining the structure, basically I would like the files to go into the main folder and the "MEDIA" folder to disappear.
The solution I use is a bit long: first I compress all the folders with winrar and then I unzip them with some parameters that remove the subfolders and keep only the files. But it becomes a very long procedure when there are many folders and you have to do it in two steps. It would be more useful to do it in one step.
Thanks in advance
is there a way to copy files (even if they are contained in subfolders) without the folder structure, manteining each parent folder?
For example I have a folder called "DEEP PURPLE IN ROCK" that contains a subfolder called "MEDIA" and inside the subfolder there are files like image.cue and image.flac
I would like to copy only the folder "DEEP PURPLE IN ROCK" and the two files without maintaining the structure, basically I would like the files to go into the main folder and the "MEDIA" folder to disappear.
The solution I use is a bit long: first I compress all the folders with winrar and then I unzip them with some parameters that remove the subfolders and keep only the files. But it becomes a very long procedure when there are many folders and you have to do it in two steps. It would be more useful to do it in one step.
Thanks in advance
Re: Copy multiple folders with files without subfolders
In the copy dialog set the value in "Only files of this type" to:
Code: Select all
*|MEDIA\
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: Copy multiple folders with files without subfolders
the problem is that I have many parent folders to copy and the subfolders inside them have different names. I would like to copy with a single command all the parent folders with the relative files inside but without the structure of the subfolders.
- ghisler(Author)
- Site Admin
- Posts: 50390
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: Copy multiple folders with files without subfolders
You can use branch view to view just the file names, then when you copy with F5 you can choose to copy the files without their relative paths.
You will still need to create the subfolders to which you want to copy. You can do this by placing the cursor on a folder, then press Shift+F7 to create a folder with the same name in the target panel.
To use branch view for a single folder, do the following:
1. Select the folder(s)
2. Press Ctrl+Shift+B
3. Select the files, e.g. with Ctrl+A
4. Press F5 to copy and uncheck the option to keep relative paths
You will still need to create the subfolders to which you want to copy. You can do this by placing the cursor on a folder, then press Shift+F7 to create a folder with the same name in the target panel.
To use branch view for a single folder, do the following:
1. Select the folder(s)
2. Press Ctrl+Shift+B
3. Select the files, e.g. with Ctrl+A
4. Press F5 to copy and uncheck the option to keep relative paths
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Re: Copy multiple folders with files without subfolders
2rockberto
For example set "Only files of this type" to:
Otherwise you could use Find files and set "Search in subdirectories" to 1 level(s) - Then Feed to listbox, mark the file but not the folders - and copy with the "Keep relative paths (relative to the current directory)" enabled - You will then get your folders copied without subfolders - but they will be placed in a folder with the name of the folder you are in when you start the Search - so you have to move the subfolders from the that folder to your final destination - so it is a 3 stage operation - but still much easier than your archive packing approach.
You can avoid the drive letter in the folder name by placing RelativePathCopy=8 in the [Configuration] section of your wincmd.ini file
If it is a limited number of diffrent subfolder names, you could still use the approach:the problem is that I have many parent folders to copy and the subfolders inside them have different names. I would like to copy with a single command all the parent folders with the relative files inside but without the structure of the subfolders.
For example set "Only files of this type" to:
Code: Select all
*|MEDIA\ foldername1\ foldername2\ foldername3\ foldername4\
You can avoid the drive letter in the folder name by placing RelativePathCopy=8 in the [Configuration] section of your wincmd.ini file
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: Copy multiple folders with files without subfolders
2rockberto
Try this *.bat for a button or em_:
Try this *.bat for a button or em_:
Code: Select all
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Purpose: Copy selected dirs with found files without structure
:: Parameters: %F <target dir\> <file masks>
:: Example: %F "%T" "file name.ext" name.txt *.jpg *.pdf
:: Condition: empty start path in a button or custom command
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off&if "%1" lss "3" exit
set n=&setlocal enabledelayedexpansion
for /f tokens^=2* %%o in ('echo %*') do set "p=%%p"
for /f tokens^=* %%d in ('^<%1 more') do (
if exist "%%d\" (
pushd "%%d"
for /f tokens^=* %%# in ('dir/a-d/b/s !p!') do (
call:loop "%~2%%~d%%~n#" %%~x#
echo f|>nul xcopy /chikqry "%%#" "!f!"
)
popd
)
)
exit
:loop
set "f=%~1!n!%2"
if exist "!f!" (
set /a c+=1&set n=_!c!
goto loop
) else set c=&set n=
Overquoting is evil! 👎
Re: Copy multiple folders with files without subfolders
thanks for the reply.
I copied the code into a .bat file, the difficulty now is how to use it inside total commander!
I copied the code into a .bat file, the difficulty now is how to use it inside total commander!

Re: Copy multiple folders with files without subfolders
Nothing difficult: drag to the button bar and follow the description.
Overquoting is evil! 👎