Fichier batch pour copîer des repertoires avec teracopy

Microsoft Windows
Post Reply
gibtoul
Posts: 2
Joined: 2022-Mar-26, 12:26 pm

Fichier batch pour copîer des repertoires avec teracopy

Post by gibtoul »

Bonjour
J'utilise teracopy pour la copie de fichier sur windows.
J'ai un dossier source avec plus de 2000 sous dossiers.
De ce répertoire source je souhaite copier les sous dossiers de façon différentes suivant les besoins
par exemple :
lancer copie 1 : sous répertoire de 1 à 100
Lancer copie 2 : sous répertoire de 1 à 10 et de 101 à 1200
Etc …
Apparemment avec une ligne de commande ou fichier batch et un fichier csv cela est possible mais je ne sais pas faire ?
J'ai trouvé cela sur le net mais je n'ai sais comment le faire :

Si votre fichier csv contient une seule colonne avec un chemin de fichier, vous pouvez simplement utiliser cette commande :

TeraCopy.exe Copie "*C:\filelist.csv" "D:\Documents"

Merci pour votre aide
Shadow Thief
Posts: 12
Joined: 2021-Aug-03, 1:45 am

Re: Fichier batch pour copîer des repertoires avec teracopy

Post by Shadow Thief »

There doesn't seem to be any pattern between the two copies. How do you know which subfolders go where?

Also, TeraCopy is third-party software; it's not installed with Windows by default.
gibtoul
Posts: 2
Joined: 2022-Mar-26, 12:26 pm

Re: Fichier batch pour copîer des repertoires avec teracopy

Post by gibtoul »

Hello,

I'm new to this forum, and I'm not sure I follow the usage.

For that, please excuse me.

For information, my level of programming knowledge is low.

About me, I'm looking for help (batch, command line, tool,...) to copy with verification, a directory containing subfolders in which several files are present.

the software to use is teracopy

My need: from a CSV list, copy only the folders and files named in the csv

selected I enclose the copy of the csv and the command line used

C:\Program Files\TeraCopy\TeraCopy.exe Copie "C:\liste.csv" "c:\Ici"

thanking you for your help

Cordially

liste.csv
C:\Users\gille\Desktop\Tempo\Various Artists - Best Of Lounge Music (Cosy Lounge)
C:\Users\gille\Desktop\Tempo\Various Artists - Best Of Lounge Music (Cosy Lounge)\01. Tennessee Waltz.flac
C:\Users\gille\Desktop\Tempo\Various Artists - Best Of Lounge Music (Cosy Lounge)\02. Il Cerchio Rosso.flac
C:\Users\gille\Desktop\Tempo\Various Artists - Best Of Lounge Music (Cosy Lounge)\03. Be Gone (Tismé Remix).flac
C:\Users\gille\Desktop\Tempo\Various Artists - Best Of Lounge Music (Cosy Lounge)\04. What's New.flac
C:\Users\gille\Desktop\Tempo\Various Artists - Best Of Lounge Music (Cosy Lounge)\05. Fake To Fake Party.flac
C:\Users\gille\Desktop\Tempo\Various Artists - Best Of Lounge Music (Cosy Lounge)\06. Theme From The Graffiti Artist.flac
C:\Users\gille\Desktop\Tempo\Various Artists - Best Of Lounge Music (Cosy Lounge)\07. Tricoter.flac
C:\Users\gille\Desktop\Tempo\Various Artists - Best Of Lounge Music (Cosy Lounge)\08. Take Three.flac
C:\Users\gille\Desktop\Tempo\Various Artists - Best Of Lounge Music (Cosy Lounge)\09. Sound Of Everything.flac
C:\Users\gille\Desktop\Tempo\Various Artists - Best Of Lounge Music (Cosy Lounge)\10. I Am Your Mind (Aaron Jerome Mix).flac
C:\Users\gille\Desktop\Tempo\Various Artists - Best Of Lounge Music (Cosy Lounge)\11. Que Bandeira.flac
C:\Users\gille\Desktop\Tempo\Various Artists - Best Of Lounge Music (Cosy Lounge)\12. Jazz Thing.flac
C:\Users\gille\Desktop\Tempo\Various Artists - Best Of Lounge Music (Cosy Lounge)\13. What Is Jazz.flac
C:\Users\gille\Desktop\Tempo\Various Artists - Best Of Lounge Music (Cosy Lounge)\14. Championsound.flac
C:\Users\gille\Desktop\Tempo\Various Artists - Best Of Lounge Music (Cosy Lounge)\15. One Man Entourage.flac
C:\Users\gille\Desktop\Tempo\Various Artists - Best Of Lounge Music (Cosy Lounge)\16. Land Of The Lost.flac
C:\Users\gille\Desktop\Tempo\Various Artists - Best Of Lounge Music (Cosy Lounge)\17. Sandy.flac
C:\Users\gille\Desktop\Tempo\Various Artists - Best Of Lounge Music (Cosy Lounge)\18. Grown Folks.flac
C:\Users\gille\Desktop\Tempo\Various Artists - Best Of Lounge Music (Cosy Lounge)\Folder.jpg
josiphfer
Posts: 1
Joined: 2023-Jun-03, 9:34 am

Re: Fichier batch pour copîer des repertoires avec teracopy

Post by josiphfer »

To copy files selectively using Teracopy and a CSV file, you can create a batch file with multiple commands, each one specifying the range of files to copy. Here's an example:

Code: Select all

@echo off
setlocal enabledelayedexpansion

set input_file=C:\Filelist.csv
set output_dir=D:\Documents

rem Copy files 1 to 100
for /L %%i in (1,1,100) do (
  set /a index=%%i-1
  set /p file= < "%input_file%"
  Teracopy.exe Copy "!file!" "%output_dir%"
)

rem Copy files 1 to 10 and 101 to 1200
for /F "tokens=1" %%i in ('type "%input_file%" ^| findstr /B /C:"file11" /C:"file10" /C:"file12"') do (
  Teracopy.exe Copy "%%i" "%output_dir%"
)

rem Copy files 2000 to 2100
for /L %%i in (2000,1,2100) do (
  set /a index=%%i-1
  set /p file= < "%input_file%"
  Teracopy.exe Copy "!file!" "%output_dir%"
)
In this example, the set input_file variable specifies the path to the CSV file containing the list of files to copy, and the set output_dir variable specifies the destination folder.

The batch file contains three commands, each one using a different approach to specify the range of files to copy. The first command uses a for /L loop to copy files 1 to 100. The second command uses a for /F loop with the findstr command to copy files 1 to 10 and 101 to 1200. The third command uses another for /L loop to copy files 2000 to 2100.

As for alternatives to Teracopy that support copying files selectively using CSV files, I recommend Gs Richcopy360 and Syncback. Both of these tools allow you to specify a CSV file containing the list of files to copy, and offer advanced options for filtering and selecting files based on various criteria. Gs Richcopy360 also offers features like real-time file synchronization and cloud backup, while Syncback offers a wide range of synchronization modes and customization options.
Post Reply