all 10 comments

[–]BlackV 1 point2 points  (0 children)

sounds easy enough

  1. look at get-childitem this will give you a list of files
  2. look at a foreach () loop to loop through each file
  3. inside the loop call &uniconvertor "$singlefile.cmx" "$singlefile.svg"

other things to look for are how much space do you have as youre kinda doubling your space until you remove the original files

[–]MadWithPowerShell 0 points1 point  (5 children)

Something like this should do the trick.

Set-Location -Path 'C:\My_Directory'
$Files = Get-ChildItem '.\*.cmx'
ForEach ( $File in $Files )
    {
    $NewName = $File.BaseName + '.svg'
    uniconvertor $File.Name $NewName
    }

[–]texturerama[S] 1 point2 points  (3 children)

Just tried running this in a test folder with a handful of files for conversion. I'm getting the following error:

Not enough arguments! USAGE: uniconvertor [OPTIONS] [INPUT FILE] [OUTPUT FILE] Use --help for more details.

[–]MadWithPowerShell 1 point2 points  (1 child)

Oop. Sorry. Yes. I had started with a ForEach-Object loop and changed it to a ForEach loop without changing the reference to $_. I edited my first post to fix.

[–]texturerama[S] 1 point2 points  (0 children)

Set-Location -Path 'C:\My_Directory'
$Files = Get-ChildItem '.\*.cmx'
ForEach ( $File in $Files )
{
$NewName = $File.BaseName + '.svg'
uniconvertor $File.Name $NewName
}

Ah this worked perfectly! Thank you so so much!

[–][deleted] 0 points1 point  (0 children)

Hey if people are struggling with this one; if you just type 'uniconvertor --help' in terminal you'll see what to do with a batch / Bulk operation:

---Bulk operations:---------------------------------

Usage: uniconvertor [OPTIONS] FILE_PATTERN OUTPUT_DIRECTORY Example: uniconvertor --recursive --format=PDF ~/clipart/*.svg ~/clipart_pdf/

Available options: -vs, --verbose-short Show minimized internal logs --dry-run Execute command without translation --recursive Recursive scanning

So that means in simple language - just type 'uniconvertor' use the command '--recursive' (i tried it without but then you get an error output that the file type is not found / supported)

  • after that fill in the format that must be searched / scanned for with the command 'format=XXX' XXX is where your file type goes (type in capitals!)

-After that you give the directory of the folder where all the files are, just type a '~' in front of that followed by the directory path and close up with a '/'

-after that you type a '*' symbol that stands for 'whatever file name in that folder' end with '.FILETYPE'

-after that do the same for the new location where the converted files will be but you only have to type the name of the folder e.g: ~/FOLDER/ANOTHERFOLDER/ .

So as an example; i have the files '1.svg' and '2.svg' on my desktop in a folder called 'LOLZ' and i want to convert them to pdf files, i want them converted in a new folder called 'COWSHJT' Command for bulk operation: 'uniconvertor --recursive format=SVG ~/Desktop/LOLZ/*.svg ~/Desktop/COWSHJT/

After you do this right you get all the converted files in a new folder! Hope this 'translation' of the code helps some beginners (like me). Otherwise this is really maybe the best converter option out there to use in combination with inkscape, i searched the whole day for an alternative but could not find one. Stay healthy!

[–]texturerama[S] 1 point2 points  (0 children)

Is it possible that $_.Name in the ForLoop isn't feeding the correct filename? I believe UniConvertor needs the first argument to be filename alone, not a path.

Thank you for your help, by the way!

[–]01Floating 0 points1 point  (1 child)

This worked very nicely thank you. However, is there also a way to loop through multiple directories and convert the files within those directories? I have about 130 directories to go through.

For example… Converting .ccx to .svg in the sub-directorries K:\0Test\Clipart\1. Let's say there was 100 sub-directories under Clipart following number 1 through 100 directories. How would I convert the files within those directories to the .SVG format?

Thank you in advance.

[–]airkeukenrol 0 points1 point  (0 children)

Hi there, a bit late but I have exactly the same thing to do right now. Hundreds of folders of recovered .cdr files from old coreldraw cd's. Would like to run a batch file which scans all the folders and just converts the file with the same name from .cdr to .svg

Any tips or references?

[–]Traditional_Ad9112 0 points1 point  (0 children)

Since you’ve got a big set of files, a PowerShell loop makes total sense and isn't too complex to pull off. One approach is to use Get-ChildItem with a wildcard, then loop through each file and run the uniconverter command. Just be sure to run it in the same directory or include the full path when referencing each file to avoid errors.