How to make duplicates with different names from a single fi

English support forum

Moderators: Hacker, petermad, Stefan2, white

User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

PowerShell: Copy one to many different names from file list

Post by *Stefan2 »

gold01 wrote:the question was to copy file (make duplicates) to a number of files (not one to one)

and according to the file names from the list

example: copy file a.pdf to 3 different files taking names from file list.txt (ss.pdf, 231.pdf, dd.pdf)
How often do you need this?

You could just open a PowerShell -Box, read in the file list, and create copies of origin.ext with names from the file list:

From:
C:\Temp\FileList.txt
              Ghislers.ext
              Total.ext
              Commander.ext

C:\Temp\Origin.ext


To:
C:\Temp\Commander.ext
C:\Temp\FileList.txt
C:\Temp\Ghislers.ext
C:\Temp\Origin.ext
C:\Temp\Total.ext


USE PowerShell:
PS C:\Temp> ( Get-Content .\FileList.txt ) | ForEach{ Copy-Item -Path .\Origin.ext -Destination $_ }
PS C:\Temp>


Done.




In short:
PS C:\Temp> (gc .\FileList.txt)|%{copy .\Origin.ext $_} 

 
gold01
Junior Member
Junior Member
Posts: 8
Joined: 2015-04-21, 07:16 UTC

Post by *gold01 »

2Vochomurka


скачал я Ваш файл Duplicate.txt а что с ним делать не знаю

как из него приготовить скрипт и как его запускать в total commander?
User avatar
Hacker
Moderator
Moderator
Posts: 13144
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

[mod]gold01,
Please, no Russian in the English forum.

Hacker (Moderator)[/mod]
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
User avatar
nsp
Power Member
Power Member
Posts: 1939
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Post by *nsp »

Dalai wrote: You're using TrendMicro, aren't you? I'm pretty sure it's a false positive, according to this VirusTotal analysis.

Regards
Dalai
THx Dalaï I've updated the files with unpacked version....

2Gold01 if you need more than advise, you must be more precise in describing what you want to do and the sequence of actions to achieve it. (You also need to help yourself a bit ;))
You already have several option using external scripting (MakeBat, TCBL, Powerpro, powershell ).
User avatar
Vochomurka
Power Member
Power Member
Posts: 816
Joined: 2005-09-14, 22:19 UTC
Location: Russia
Contact:

Post by *Vochomurka »

Single user license #329241
PowerPro scripts for Total Commander
Post Reply