Ok so after several attempts on figuring out some powershell and or .bat usage, I find that I am limited based on security being able to run scripts on my work system. I tried running a .bat file that would execute a .ps1 file and would get security errors.
So I'm not going to go into how to subvert your windows OS security just to allow running these scripts as the potential danger and risk to making a very powerful tool automated and leaving your PC vulnerable.
So I have come away with doing this for me in win10 and using powershell. For now I won't use the Advanced part of the export function of the BSS app.
Click start and for win10 just start typing in powershell, select "Windows Powershell" from the list. I right clicked it and pinned it to the task bar so I can launch it from there.
In powershell I'm going to use the following command (I haven't figured out the method to change directories and execute this in a single process)
Get-ChildItem -Filter "*.html" -Recurse | Rename-Item -NewName {$_.name -replace 'html','shtml'}
This command generally does the following based on how I understand it.
- Get all child elements with the file name .html [the asterisks is a wildcard character meaning any/all files with the ".html" extension]
- Recurse - find all files from with in the root AND sub folders, root is the current folder that powershell has as the command line
- Rename some items with a new name
- Replacing the [first value] with the [second value]
So you will need to use DOS/batch style commands to get to the appropriate directory in order to execute it.
If you are exporting to a network drive, it will be easiest to MAP the network drive first. Preferably the folder that is the root for your export. I will use "T:\bss_export" for example.
Once you start Powershell it most likely starts with the command line of PS C:\Users\[your username]
Using the networked drive example
- type in
cd "T:"
(hit enter) (I mapped my network drive to T)
- if it's a subfolder type in
cd "bss_export"
(hit enter) (I had a subfolder for test)
The Powershell commandline would look something like this for me PS T:\bss_export
If like me I need to change all the .html exported extension to .shtml then copy/paste in this command and hit enter
Get-ChildItem -Filter "*.html" -Recurse | Rename-Item -NewName {$_.name -replace 'html','shtml'}
For people that need to switch some of your files to .php then I think this would do for you. Before you export, rename the files you want to be php files by including "_php" in the file name before the .extension
So that you could then use these 2 commands.
Get-ChildItem -Filter "*_php*" -Recurse | Rename-Item -NewName {$_.name -replace 'html','php'}
Get-ChildItem -Filter "*.php" -Recurse | Rename-Item -NewName {$_.name -replace '_php',''}
First command will rename files that contain _php in the name it will rename it to a .php file then the second command will find those .php files and rename the file by removing the _php wording in the file name.
A Big thing here is that this does not replace/overwrite existing files.
I haven't figured out a way for that.
You could try the following below but I think I will export to a holding area rename the files like above and then move them where I need them.
<hr />
I could use these 2 commands to work around that BUT I would have to be sure that any editing is done in the BSS app not after because this will delete the old file.
Make my edits in the BSS app not outside it then export then run powershell etc and run this command to remove all files.
Get-ChildItem *.shtml -Recurse | Remove-Item
Then I could run this to get back to the correct file .extension
Get-ChildItem -Filter "*.html" -Recurse | Rename-Item -NewName {$_.name -replace 'html','shtml'}
I'll look into .bat file commands and see what I can up with for that.
Saj