1 year ago
#77222
stefmf
Script to sequentially move 5,000 files at a time?
I created 1 million files that I'm trying to upload to a device. However, file explorer crashes if I select too many at once. I'm trying to break them up and move them into subfolders in batches of 5000.
The naming scheme for the files are snowfile1.txt
- snowfile1000000.txt
The naming scheme for the folders are snow1
- snow200
What script can I use to move files 1-5000 into folder 1, then repeat or for loop for the next 199 folders in sequence?
Thanks in advance for all the help!
EDIT: I figured it out! Thanks for recommending I use robocopy & encouraging me to figure it out my self. I actually learned something new!
Solution:
for ($i = 10; $i -lt 15; $i++) {
ROBOCOPY (source) (destination) (file)$i.txt /MOV
}
Didn't get around to figuring out how to script it to do it for all my folders at once, but I'm getting close.
Thanks again!
linux
windows
powershell
powershell-2.0
0 Answers
Your Answer