Count of Files

Ask your 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.
This topic is 5 years and 1 week old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Count of Files

Post by jvierra »

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
apowershelluser
Posts: 194
Last visit: Fri Mar 22, 2024 4:38 am
Answers: 2

Re: Count of Files

Post by apowershelluser »

This looks promising as a start
SymLink.png
SymLink.png (14.92 KiB) Viewed 1966 times
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Count of Files

Post by jvierra »

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
apowershelluser
Posts: 194
Last visit: Fri Mar 22, 2024 4:38 am
Answers: 2

Re: Count of Files

Post by apowershelluser »

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.
  1. $user = 'USERNAME'
  2. $Folders = @(
  3.  
  4. #Destkop
  5. "C:\users\$user\Desktop"
  6.  
  7. #Documents
  8. "C:\users\$user\Documents"
  9.  
  10. #Downloads
  11. "C:\users\$user\Downloads"
  12.  
  13. #Favorites
  14. "C:\users\$user\Favorites"
  15.  
  16. #Links
  17. "C:\users\$user\Links"
  18.  
  19. #Music
  20. "C:\users\$user\Music"
  21.  
  22. #Pictures
  23. "C:\users\$user\Pictures"
  24.  
  25. #Videos
  26. "C:\users\$user\Videos"
  27.  
  28. )
  29.  
  30. foreach ($Folder in $Folders){
  31. $Link = Split-Path $folder -Leaf
  32. cmd /c mklink /d C:\Windows\temp\Link\$link $Folder
  33. }
This topic is 5 years and 1 week old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked