Jump to content

How-to: Copy files using filename list

From TotalcmdWiki

Task description

Locate the files specified in a list within a base folder and copy the found files to a destination folder, preserving their folder paths relative to the base folder.

Instructions

Below are three methods to accomplish the task.

Copy using file type filter

This is the simplest method but limited by the file type field limit (1022 characters).

Steps:

  1. Navigate to the base folder in one panel and to the target folder in the other panel.
  2. Go to the panel with the base folder and select all files and folders.
  3. Press F5 to open the Copy dialog.
  4. In the Only files of this type field, list the filenames to copy separated by spaces. Put filenames that contain spaces in double quotes and append |**\ to the end of the field to avoid creating empty folders.
  5. Start the copy operation.
  6. Unselect all files that are still selected.

Use branch view and load selection from file

Steps:

  1. Prepare a plain text list file with one filename per line, each listed exactly as *"filename" (an asterisk followed by the filename in double quotes).
  2. Navigate to the base folder in one panel and to the target folder in the other panel.
  3. Go to the panel with the base folder.
  4. Open branch view via the menu CommandsBranch view (Ctrl+B), which displays all files in the folder and its subfolders.
  5. Use the menu option MarkLoad Selection From File.
  6. Select your prepared list file and click Open. The files matching the list will be selected in branch view.
  7. Press F5 to open the Copy dialog and enable the Keep relative paths option.
  8. Start the copy operation.

Use search with a search list

Searching using a search list performs a separate search for each line in the list, which is be inefficient if the folder structure is large.

Steps:

  1. Prepare a plain text list file with one filename per line, each listed exactly as *"filename".
  2. Save the list file in the base folder.
  3. Navigate to the base folder in one panel and to the target folder in the other panel.
  4. Go to the panel with the base folder.
  5. Open the Search dialog (Alt+F7).
  6. In the Search in field, enter @listfilename.txt (replace with your actual list filename).
  7. Click Start search.
  8. Click Feed to listbox when the search is finished.
  9. Press Ctrl+A to select all files.
  10. Press F5 to open the Copy dialog and enable the Keep relative paths option. Note that this will recreate the full folder path within the target folder, by default including the drive letter without colon.
  11. Start the copy operation.
  12. In one panel, navigate to the target folder containing the newly created folder structure.
  13. In the other panel, navigate inside the newly created folder structure, descending through folders until you reach the intended relative folder level.
  14. Select all files and folders at this level.
  15. Press F6 (Move) and move them to the target folder.
  16. Delete the now empty top-level folder named after the drive letter.