xen111

New Member
Joined
Nov 10, 2013
Messages
1
I haven't done any programming for a long time, and virtually haven't done any Windows scripting since the days of MS-DOS.

For my digital audio needs I am planning to separate my music collection into 3 folder trees:
- lossless albums
- lossy albums inclusive
- lossy albums exclusive.

The lossless (FLAC) albums and the lossy (MP3) inclusive albums will be combined into a single library for every kind of jukebox software I use, ie. currently Winamp and Squeezebox. These two collections are disjunctive, they do not overlap. The combined view won't have duplicates.

The exclusive lossy albums are albums of which I have a FLAC version as well. This means "lossless + inclusive = all albums I have", "inclusive + exclusive = all lossy albums I have" and "lossless + exclusive = identical set".

In particular for this to work, I need a way to combine the inclusive and exclusive trees so I can at least copy albums from it to mobile players or other uses that require small file size.

In linux, I would simply create a 'virtual' tree consisting just of symbolic links to all the directories in all of the two trees. I would write a shell script that would create, update and delete these symbolic links. I'm not sure however if this would allow me to copy the actual directories (and not just the symlinks).

I'm looking to achieve the same thing in Windows. What kind of scripting would you use for this? What is easiest to achieve? I know that it is possible to create a kind of symbolic links.

I tried to use Cygwin some time ago for something unrelated, but either I was doing it all wrong, or it didn't work at all - especially ran into problems with files that had spaces and trying to escape these spaces. All that fun.

Can you point me in the right direction?
 
Solution
To achieve the folder organization and linkage you described in Windows, you can use PowerShell scripting. PowerShell is a powerful scripting language that allows you to automate tasks and manage the Windows operating system efficiently. Here's a general approach you can take to set up the directory structure you need with symbolic links in Windows:
  1. Create the Folder Structure:
    • First, organize your music collection into the three main folders: lossless albums, lossy albums inclusive, and lossy albums exclusive.
    • Make sure the albums are appropriately categorized in each folder.
    []Create Symbolic Links:
    • Use PowerShell to create symbolic links from the inclusive and exclusive folders to a combined...
To achieve the folder organization and linkage you described in Windows, you can use PowerShell scripting. PowerShell is a powerful scripting language that allows you to automate tasks and manage the Windows operating system efficiently. Here's a general approach you can take to set up the directory structure you need with symbolic links in Windows:
  1. Create the Folder Structure:
    • First, organize your music collection into the three main folders: lossless albums, lossy albums inclusive, and lossy albums exclusive.
    • Make sure the albums are appropriately categorized in each folder.
    []Create Symbolic Links:
    • Use PowerShell to create symbolic links from the inclusive and exclusive folders to a combined view folder.
    • Symbolic links in Windows will allow you to reference the original folders without duplicating the files.
    [
    ]PowerShell Scripting:
    • Write a PowerShell script that creates symbolic links in a new directory for the combined view based on the contents of the inclusive and exclusive folders.
    • Ensure that the script handles spaces in file names correctly. Here's a simplified example of how you can use PowerShell commands to create symbolic links:
      Code:
      # Define paths to your three main folders $losslessPath = "C:\Music\Lossless" $inclusivePath = "C:\Music\Lossy Inclusive" $exclusivePath = "C:\Music\Lossy Exclusive" $combinedViewPath = "C:\Music\Combined View" # Create symbolic links for inclusive and exclusive albums in the combined view New-Item -ItemType SymbolicLink -Path $combinedViewPath -Name "Inclusive" -Value $inclusivePath New-Item -ItemType SymbolicLink -Path $combinedViewPath -Name "Exclusive" -Value $exclusivePath # You can also loop through the folders in the inclusive and exclusive directories to create symbolic links for individual albums
      This script is a basic starting point. You can extend it to include looping through the folders in the inclusive and exclusive directories to create symbolic links for individual albums. For handling spaces in file names, PowerShell supports quoting paths that include spaces, which should help avoid issues with file names containing spaces. Feel free to adjust and expand upon this script based on your specific folder structure and requirements. PowerShell scripting provides a flexible and robust way to manage file operations and symbolic links in Windows. Let me know if you need further assistance or more detailed guidance on any specific aspect of this process!
 
Solution
Use symbolic links (mklink) on Windows to combine your "inclusive" and "exclusive" album folders into a virtual tree. You can automate this with PowerShell or batch scripting to create links to each directory in the combined folder. To copy the actual files (not just the links), use Robocopy or xcopy with the /e flag. Make sure to wrap paths with spaces in quotes.