Automate a task with a Windows script


RobLI57

New member
Local time
10:48 AM
Posts
17
OS
Windows 11 Pro
Hi All,
I run an internet radio station that consists of two Windows PC's. One in the cloud on a VM, the other in my home. These machines are not exact duplicates, for example, the cloud is Windows 10 Pro, my home is Win 11 Pro. But they both have exact same Playout software running so that either one is capable of running the radio station. This means that I've got the extra work of keeping both PCs in sync. For example, if I add new music, I need to add that same song, with the same cart number to the other PC so that both can play it, and the music scheduler can schedule it. The station consists of two pieces of software that are the brains of the station:
1. The Radio Playout Software (Installed on both PCs)
2. The Music Scheduler (Installed on the Cloud PC)

The Music Scheduler being only on one machine is what I'm trying to solve for. When I log into the Cloud VM to schedule a day of music, the system generates 24 files. One for each hour of the day. Each filename consists of a number which is formatted as follows: "yyyymmddhh.dpl". So, if I were creating a music log for Feb 22, 2024 7 PM hour it would be named: 2024022219.dpl. The music scheduler places them in a directory called "C:\Music 1\Automation Logs". The Playout Software is configured to look there and each hour it opens the next hour for playback.

Because I can't have the Music 1 software on the other PC, I have to manually opening up that folder, sorting the files by "Date Modified", copy the files with the current date into another folder. I zip them and transfer them to the Home PC where I unpack and copy them into the same "C:\Music 1\Automation Logs" folder. This is what I've been doing now for almost a year to keep these systems in sync. By the way, this Automation Logs folder is full of files that go back to 2020 when I put the station on the air.

Scheduling music is a pretty tedious task, so based on how I feel, I might do only one day, and on a good day, maybe two days. So each time there will be either 24 or 48 files to copy and zip up.

It suddenly dawned on me that this could be accomplished with a basic Windows CMD script that would sort the folder by latest date, grab all the current day's files, copy them, and zip them into a folder on my desktop. From there, I could run the file transfer I use which is part of Splashtop software that is used for remote access to the other PC.

On my best day, the best I can do is find a script that is close to what I need and hack it a little to make it work. But I can't seem to find anything specific enough to accomplish this. Can someone point me in the right direction on this and please share the proper commands to accomplish this sort process? I would appreciate the help.
Thanks
Rob
 
Windows Build/Version
Win 10 Pro & Win 11 Pro

My Computer

System One

  • OS
    Windows 11 Pro
    Computer type
    PC/Desktop
    CPU
    12th Gen Intel(R) Core(TM) i7-12700 2.10 GHz
    Memory
    16Gb
It suddenly dawned on me that this could be accomplished with a basic Windows CMD script that would sort the folder by latest date, grab all the current day's files, copy them, and zip them into a folder on my desktop. From there, I could run the file transfer I use which is part of Splashtop software that is used for remote access to the other PC.
The SS64 site is one of the best sites for documenting the CMD commands.

From what you say, I am unsure as to whether you want to make a list of a directory contents, and save the list to the desktop; or if you want to actually copy the source files to the desktop destination.
They would be different instructions.

DIR would be able to produce a sortable list of filenames:

and, COPY would be able to copy your files to the desktop, if that is what you preferred to do:
 
Last edited:

My Computers

System One System Two

  • OS
    Windows 11
    Computer type
    PC/Desktop
    CPU
    AMD Ryzen 5 5600
    Motherboard
    MSI B550-A Pro
    Memory
    16 GB
    Graphics Card(s)
    Sapphire Radeon RX 6500XT (8 GB version)
    Monitor(s) Displays
    BenQ Mobuiz EX2710Q QHD, Iiyama ProLite X23377HDS
    Hard Drives
    MSI Spatium M461 4TB
  • Operating System
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    Acer A114
    CPU
    Intel Celeron N4020
Thanks, I'll look at that site.
To answer your question, I am looking to sort the files by date. Copy the files created on the current day, zip them up and place the zip file in a folder on the desktop of the computer.
 

My Computer

System One

  • OS
    Windows 11 Pro
    Computer type
    PC/Desktop
    CPU
    12th Gen Intel(R) Core(TM) i7-12700 2.10 GHz
    Memory
    16Gb
I'm gonna to ask the obvious:
Why don't you use OneDrive, DropBox or Google Drive to sync files between the two PC's? I suppose the playlists aren't large files, so sync updates wouldn't take that long to complete. And you wouldn't have to learn much programming.
 

My Computer

System One

  • OS
    Windows 7
Hmmm....
I hadn't considered that as an option. I use OneDrive to back my SQL db backups and music library in the cloud but never considered that it could also be used to keep two directories in sync on the two PCs. I'll look at that, thank you for the suggestion.
 

My Computer

System One

  • OS
    Windows 11 Pro
    Computer type
    PC/Desktop
    CPU
    12th Gen Intel(R) Core(TM) i7-12700 2.10 GHz
    Memory
    16Gb

My Computers

System One System Two

  • OS
    11 Home
    Computer type
    Laptop
    Manufacturer/Model
    Asus TUF Gaming (2024)
    CPU
    i7 13650HX
    Memory
    16GB DDR5
    Graphics Card(s)
    GeForce RTX 4060 Mobile
    Sound Card
    Eastern Electric MiniMax DAC Supreme; Emotiva UMC-200; Astell & Kern AK240
    Monitor(s) Displays
    Sony Bravia XR-55X90J
    Screen Resolution
    3840×2160
    Hard Drives
    512GB SSD internal
    37TB external
    PSU
    Li-ion
    Cooling
    2× Arc Flow Fans, 4× exhaust vents, 5× heatpipes
    Keyboard
    Logitech K800
    Mouse
    Logitech G402
    Internet Speed
    20Mbit/s up, 250Mbit/s down
    Browser
    FF
  • Operating System
    11 Home
    Computer type
    Laptop
    Manufacturer/Model
    Medion S15450
    CPU
    i5 1135G7
    Memory
    16GB DDR4
    Graphics card(s)
    Intel Iris Xe
    Sound Card
    Eastern Electric MiniMax DAC Supreme; Emotiva UMC-200; Astell & Kern AK240
    Monitor(s) Displays
    Sony Bravia XR-55X90J
    Screen Resolution
    3840×2160
    Hard Drives
    2TB SSD internal
    37TB external
    PSU
    Li-ion
    Mouse
    Logitech G402
    Keyboard
    Logitech K800
    Internet Speed
    20Mbit/s up, 250Mbit/s down
    Browser
    FF
Absolute Genius! All set, works amazing, problem solved, and I see solutions for a few other time consuming tasks I've been performing for almost a year now.
Thank you!
 

My Computer

System One

  • OS
    Windows 11 Pro
    Computer type
    PC/Desktop
    CPU
    12th Gen Intel(R) Core(TM) i7-12700 2.10 GHz
    Memory
    16Gb

Latest Support Threads

Back
Top Bottom