Count of Files

Ask your Windows PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
jvierra
Posts: 13615
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Count of Files

Post by jvierra » Fri Mar 22, 2019 10:57 am

I didn't say link multiple to one. Create multiple links in a single new folder each with its own name.


c:\mylinks
c:\mylinks\desktop => link to user desktop
c:\mylinks\documents => link to user documents
c:\mylinks\pictures => link to user pictures
… etc ...

User avatar
JohnTitor
Posts: 153
Joined: Fri Nov 17, 2017 8:49 pm

Re: Count of Files

Post by JohnTitor » Fri Mar 22, 2019 11:38 am

This looks promising as a start
SymLink.png
SymLink.png (14.92 KiB) Viewed 703 times

User avatar
jvierra
Posts: 13615
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Count of Files

Post by jvierra » Fri Mar 22, 2019 12:23 pm

Once again. Please do not psot images of code. It is useless to anyone viewing this forum. Use the code posting tools provided.

User avatar
JohnTitor
Posts: 153
Joined: Fri Nov 17, 2017 8:49 pm

Re: Count of Files

Post by JohnTitor » Fri Mar 22, 2019 12:58 pm

whoops, sorry about that. I've confirmed this works as expected and will update once I get robocopy to count/copy folders in one command.

Code: Select all

$user = 'USERNAME'
$Folders = @(

#Destkop
"C:\users\$user\Desktop"

#Documents
"C:\users\$user\Documents"

#Downloads
"C:\users\$user\Downloads"

#Favorites
"C:\users\$user\Favorites"

#Links
"C:\users\$user\Links"

#Music
"C:\users\$user\Music"

#Pictures
"C:\users\$user\Pictures"

#Videos
"C:\users\$user\Videos"

)

foreach ($Folder in $Folders){
$Link = Split-Path $folder -Leaf
cmd /c mklink /d C:\Windows\temp\Link\$link $Folder
}

Locked