This project relates to 6 x weekly radio show mp3 files that are downloaded via Dropbox into a folder, those file need renaming so they can be imported into a radio playout system.
I require a batch file, that runs in windows (win 10) scheduler to auto-unzip files into a folder, identifiy those files by a specific marker (P1-P6) within the file name and rename with the absolute prefix of 1001 -1006 and a space needs inserting before any further charrecters. ( 1001, space, file name, date. mp3)
Source directory: c:\Users\andre\Desktop\Silky Sounds unzipped
Original File names:
Glyn Williams Silky Soul E148 [login to view URL]
Glyn Williams Silky Soul E148 [login to view URL]
Whereby:
'Glyn Williams Silky Soul' is usually constant
E148 changes each week, next week will be E149, week after E150
P1 = part 1, there is 6 parts each week
Destination Folder:
C:\Users\andre\Desktop\SS-renamed
New File name examples that is required:
1001 SSoul E148 P1 (current date).mp3
1002 SSoul E148 P2 (current date),mp3
1003 SSoul E148 P2 (current date),mp3
1004 SSoul E148 P2 (current date),mp3
Is .bat file the best way to achieve this function?
Hello,
Yes batch file or PowerShell script can achieve the task you mentioned in your project. I can provide you the script to unzip, move files to destination folder and rename files. I've done similar work before.
Best,
Kashif
Hello,
This is all doable in a batch file. As for whether it's best, unzipping and renaming based on part number would be slightly easier in something else but they have their own drawbacks. Also, handling errors in case the scheduled task happens to run at the same time as DropBox is downloading could be more elegant outside batch.
In Windows 10 other built-on scripting options are VBScript and PowerShell. VBScript started dying years ago, I wouldn't consider it. PowerShell is great and incredibly powerful but there's potential that enabling a script to be scheduled would need a Windows setting ('Execution Policy') to be changed.
I don't think it would be much faster to write in PowerShell vs batch so it's all much of a muchness and probably down to what you would be more comfortable with. I could help either way.