Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Clear-Host
- Write-Host "Moving music parent directories to Fermion..."
- $file = gc "C:\Users\Derrick Liu\Desktop\Played.txt"
- $destination = "\\ld-fermion\music"
- foreach ($path in $file)
- {
- $lastIndex = $path.lastindexof('\')
- $filename = $path.substring($lastIndex)
- $directory = $path.substring(0, $lastIndex)
- $subDirectory = [regex]::split($directory, "music")[1]
- $coalesced = $destination + $subDirectory
- if(![IO.Directory]::Exists($coalesced))
- {
- Write-Host "Copying " $directory " to " $coalesced
- cp $directory $coalesced -recurse
- }
- else
- {
- Write-Host "Directory already exists, not copying."
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement