Answer the question
In order to leave comments, you need to log in
A task has arrived and I can’t execute it on cmd and ps in any way, who can help?
The essence of the task, there are 100 files 1file.log; 2file.log; 3file.log; 4file.log...
there are 100 more folders 1folder; 2folder; 3folder; 4folder...
(all files and folders on the desktop)
Use PS or CMD to scatter files into folders named 1file=>1folder; 2file=>2folder... Tell me
or help someone who can, thanks in advance =)
Answer the question
In order to leave comments, you need to log in
1..100 | foreach-Object {
Move-Item "Path/To/File/$($_)file.log" -Destination "Path/To/Folder/$($_)folder"
}
@for /L %%a IN (1,1,100) do @echo move "source/dir/%%afile.log" "dest/dir/%%afolder"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question