F
F
Fatal2222019-01-08 07:29:26
Total Commander
Fatal222, 2019-01-08 07:29:26

Do you need a script that will search for files with the same name, create folders with the same name for these files, and move them there?

We need a script that will search for files with the same name, create folders with the same name for these files and transfer them there.
For example, there are six files in one folder: 1.txt , 1.png , 2.txt , 2.png , 3.txt , 3.png .
After the script has run, three folders should appear in which our files will be transferred: in the folder with the appeared name "1" there will be files: 1.txt , 1.png ; in folder "2" there will be files: 2.txt , 2.png , and in folder "3" respectively: 3.txt , 3.png .
Maybe this chain of actions is easier not to do in the total, but in some other program.
Maestro and gurus, help a person who does not understand this.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Eugene, 2019-01-08
@yellowmew

A simple powershell script

$searchfolder = "j:\1"
$storefolder = "j:\2"
New-Item $storefolder -ItemType Directory -ErrorAction SilentlyContinue -Force
Get-ChildItem $searchfolder -File -Recurse | %{
    $newpath = Join-Path $storefolder -ChildPath $_.BaseName
    New-Item $newpath -ItemType Directory -ErrorAction SilentlyContinue -Force
    Move-Item -LiteralPath $_.FullName -Destination $newpath 
}

L
l_e_v, 2019-01-10
@l_e_v

Select files
Ctrl+M
Upper right corner - Rename mask: file name - [N]\[N]
Start

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question