S
S
serg Kro2015-04-28 15:33:26
cmd/bat
serg Kro, 2015-04-28 15:33:26

How to make a script to transfer files?

Good day.
Please help with the script. Something didn't work out for me. (can you tell me where to google)
The directory contains the files name, name-f, name1, name1-f name2-a name2 name3-f name3 , etc.
Only the name-f name files need to be transferred to another directory. That is, files with "-a" and their corresponding names should be left.
Began so:
find *-f > files.txt
What further to do with it - not clearly.
In theory, you need to discard -f, insert into the search string what happened line by line, and transfer what it finds.
In general, please help.
OS Windows 7

Answer the question

In order to leave comments, you need to log in

3 answer(s)
E
Eugene, 2015-04-28
@Karadar

PowerShell
Get-Childitem d:\test\*-f.* | Move-Item -Destination d:\test\test
Get-ChildItem d:\test\test\*-f.* | Rename-Item -Newname {$_.name -replace "-f",""}

C
Cront, 2015-04-28
@Cront

Run PowerShell - there is a default in the seven and run in the source folder:
Get-ChildItem -Filter *.-f -File | Move-Item -Destination "c:\destination" , with the correct path to the folder to move to.

M
Mikhail Lyalin, 2015-04-28
@mr_jok

loops on if exist, etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question