split files in different directories


hello,

we have directories lot of files (about 20.000 or more). want move(split) files subdirectories (4 subdirecotries).

so every subdirectory have 5000 files.

directory 1 = first 5000 files
directory 2 = next 5000 files
...
directory 4 = last 5000 files

each subdirectory shozld have same number of files.
can count files with

$count = ls directory\*.job).count
, divide subdirectories.
$movecount = $count/4

how can move specific number ($movecount) files?
can give me hint?

try idea:

  gci | out-file filelist.txt gc filelist.txt -readcount 5 | % {     $_     write-host "next 5"     }  


([string](0..9|%{[char][int](32+("39826578846355658268").substring(($_*2),2))})).replace(' ','')


Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

CRL Revocation always failed

Failed to query the results of bpa xpath

0x300000d errors in Microsoft Remote Desktop client