Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
nielsm
Jun 1, 2009



BeastOfExmoor posted:

Humble Request

Alternative solution, in PowerShell.

Save this to a text file, e.g. Replace-FileByName.ps1:
code:
[CmdletBinding(SupportsShouldProcess=$true)]
Param(
    [string]$SearchFileName,
    [string]$ReplacementFileName,
    [string]$SearchBase=".",
    [switch]$Rename
)
$originalFiles = Get-ChildItem -LiteralPath $SearchBase -Filter $SearchFileName -Recurse -File
foreach ($orgFile in $originalFiles) {
    Write-Verbose $orgFile.FullName
    if ($Rename) {
        Remove-Item -LiteralPath $orgFile.FullName
        Copy-Item -LiteralPath $ReplacementFileName -Destination $orgFile.DirectoryName
    } else {
        Copy-Item -LiteralPath $ReplacementFileName -Destination $orgFile.FullName
    }
}
Then you can call the script like this to replace oldfile.bin with newfile.bin, keeping the oldfile.bin filename:
pre:
.\Replace-FileByName.ps1 -SearchFileName oldfile.bin -ReplacementFileName d:\newfile.bin
If you'd rather the replaced files are called by the replaement's filename:
pre:
.\Replace-FileByName.ps1 -SearchFileName oldfile.bin -ReplacementFileName d:\newfile.bin -Rename
Or to check what will happen beforehand:
pre:
.\Replace-FileByName.ps1 -SearchFileName oldfile.bin -ReplacementFileName d:\newfile.bin -WhatIf
Or get it to print destination filenames before each replacement, and still perform all the replacements:
pre:
.\Replace-FileByName.ps1 -SearchFileName oldfile.bin -ReplacementFileName d:\newfile.bin -Verbose
You can also get it to confirm before each replacement: (But beware that the "Yes to all" and "No to all" choices don't work due to the foreach loop. I don't know what the best way to get around that is.)
pre:
.\Replace-FileByName.ps1 -SearchFileName oldfile.bin -ReplacementFileName d:\newfile.bin -Confirm
This isn't thoroughly tested, I'm sure there's plenty of room for improvement.

Adbot
ADBOT LOVES YOU

nielsm
Jun 1, 2009



I won't be the one to make a solution to it, but I imagine anyone else doing it will want to ask:
Which mail service or client?

nielsm
Jun 1, 2009



project.log should be the forum for that kind of projects where you can blog and test as much as you want. I think.

nielsm
Jun 1, 2009



Writing it as a foobar2000 plugin would simplify the entire reading and writing music file metadata, letting you focus on just the look-up part. It sounds like the best approach to take.

nielsm
Jun 1, 2009



gary oldmans diary posted:

In powershell, how can I do something as simple as getting some temporary variables from a file name?
Such as:
FOR /F "delims=-_ tokens=1-3" %D IN ('dir /b ????-??-??_*.*') DO ECHO MM/DD/YYYY: %E/%F/%D

Regular expression matching:
code:
Get-ChildItem -Path $foo | ForEach-Item {
  if ($_.Name -Match "^(\d{4})-(\d\d)-(\d\d)_") { "MM/DD/YYYY: $($Matches[2])/$($Matches[3])/$($Matches[1])" }
}
I'm not sure if there is a better way to write the string interpolation when using an array valued variable.

nielsm
Jun 1, 2009



Have you looked at room or conference planning software?

nielsm
Jun 1, 2009



Actually, can't you more or less do it with MS Outlook, having multiple calendars (one per track) open in week or schedule view? You can drag appointments around within a calendar and between calendars there.

With the old version I happen to have installed:

nielsm
Jun 1, 2009



Sri.Theo posted:

Is something that could take a OneNote file, on macOS, and export it to text files (maybe using Markdown) in structured folders (Notebook, Section, Pages) trivial or virtually impossible?

I've found a couple of projects that can do it, but one is Window's only and the other requires messing around with Azure directory in a way that looks tricky.

https://github.com/alxnbl/onenote-md-exporter
https://github.com/Danmou/onenote_export

The first one is indeed Windows only yes, despite being implemented in .NET 5. It depends on a COM library installed with the Office for Windows version of OneNote, so it won't work on non-Windows systems. That library is used to do the actual reading of the contents.

The second uses Office Online, logging in via Azure/Microsoft account, and will only work with notebooks stored on OneDrive. It shouldn't be difficult to get working, but it's useless if you have the OneNote data as a classic local file.

You'd have to go looking for (or write from scratch) an implementation of the file format (documented here) to make a platform-agnostic exporter, that also isn't dependent on other locally installed software or the data being on OneDrive.

nielsm
Jun 1, 2009



There are also some good tagging and renaming tools in foobar2000

Adbot
ADBOT LOVES YOU

nielsm
Jun 1, 2009



Set up a live streaming server and then have vlc or mpv or something stream a playlist to it.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply