0

I would like to copy several files (with different paths) in one folder. I tried this solution explained here page of example on stackexchange but when I run the file (I choosed .bat file) I have "0 file copied" like that: screen capture 0 file copied

here is some example of my list.txt :

T:/audio/enregistrements/2023-03-mars/maroc_2023/msd1/test.txt
T:/audio/enregistrements/2023-03-mars/maroc_2023/msd6/20230324_0454_0627_ailes oiseau et cris oiseau indetermine cala iris sentier maroc_35.1287,-4.3661_MKH8020_AB_230324_014.WAV
T:/audio/enregistrements/2023-03-mars/maroc_2023/msd6/20230324_0627_0801_ailes mesange guepier europe et chien ou loup cala iris sentier maroc_35.1287,-4.3661_MKH8020_AB_230324_015.WAV
T:/audio/enregistrements/2023-03-mars/maroc_2023/msd2/20230323_0551_0724_bruant fou fauvette melanocephale ailes pigeon ramier cala iris Maroc_35.1290,-4.3661_MKH8040_ORTF__Z_F3_230323_009.WAV
T:/audio/enregistrements/2023-03-mars/maroc_2023/msd1/20230401_0745_0918_alouette lulu_ifrane Maroc_33.5174,-5.1753_MKH8020_AB230401_014_best best mais avec vent.WAV
T:/audio/enregistrements/2023-03-mars/maroc_2023/nagra/20230401_0954_alouette lulu ifrane maroc_33.5152,-5.1763_telinga dpa 4060 nagra7_Pichard20230401094912_002_best_best.wav

my script.bat is into T:\audio\enregistrements\2023-03-mars\maroc_2023\ folder. It contains that :

@echo off
for /f "tokens=* delims=" %%a in ('type "T:\audio\enregistrements\2023-03-mars\maroc_2023\list.txt"') do xcopy /hrkvy "%%a" "T:\audio\creation_sonore\projet maroc\complement"
pause

I'm sure folder T:\audio\creation_sonore\projet maroc\complement exist.But there is also nothing in "complement" folder..

what could be the problem please ? Thanks

2
  • Are you married to using a batch file versus a PowerShell script?
    – Brian
    Commented Jul 9, 2023 at 21:17
  • Thanks Brian, I moved to powershell and it works fine (see below) Commented Jul 11, 2023 at 9:23

1 Answer 1

0

In fact I asked to chatgpt, it solved my problem. I post here the solution with powershell :

Here is the PowerShell script to use to copy a list of files to a directory:

Get-Content "path\to\file\list.txt" | ForEach-Object {Copy-Item $_ -Destination "path\to\destination\directory"}

Make sure to replace "path\to\file\list.txt" with the full path to the text file containing the list of files to copy, and "path\to\destination\directory" with the full path to the destination directory where you want to copy the files.

It works very well :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .