Making a folder on Windows with Script Scripter

Post Reply
User avatar
gabrielp
Advanced member
Posts: 577
Joined: Fri Aug 08, 2014 4:31 pm
Location: Boston
Contact:

Making a folder on Windows with Script Scripter

Post by gabrielp »

Does anyone know how to make a folder via Scripter on Windows? I'm trying to Process.execute with the commands md and mkdir but I'm getting the following error: "Failed to run external process: mkdir".
Chat: open-automation @ gitter
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
sander
Advanced member
Posts: 228
Joined: Wed Oct 01, 2014 8:58 am
Location: The Netherlands

Re: Making a folder on Windows with Script Scripter

Post by sander »

Command: C:/Windows/System32/cmd.exe
Arguments: /c "mkdir d:\folder"

mkdir runs from within the command prompt, you can't call it directly.

/C Carries out the command specified by string and then terminates

Edit: I misread, thought you was using Execute Command. However via scripting it's the same, call mkdir via cmd.exe.
Edit2: This will do: Process.execute("c:/Windows/System32/cmd.exe /c \"mkdir d:\\folder\"")
Part of my playground:
- HP Indigo 10k, HP Indigo 7600's (full options), Highcon Euclid III, Zünd S3
- HP Production Pro 6.0.1, HP Production Center 2.5.1 beta, Apogee 9.1, Enfocus Switch 13u1 & PitStop Server 13u2.

Chat: open-automation @ gitter
User avatar
gabrielp
Advanced member
Posts: 577
Joined: Fri Aug 08, 2014 4:31 pm
Location: Boston
Contact:

Re: Making a folder on Windows with Script Scripter

Post by gabrielp »

Woah, thanks for that. I there any way of doing this for Mac environments so you can get CLI behavior identical to the normal terminal within Scripter?
Chat: open-automation @ gitter
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
sander
Advanced member
Posts: 228
Joined: Wed Oct 01, 2014 8:58 am
Location: The Netherlands

Re: Making a folder on Windows with Script Scripter

Post by sander »

Not sure, I'm more a Windows guy. Since my Switch is on Windows too I can't really test to figure it out.
Part of my playground:
- HP Indigo 10k, HP Indigo 7600's (full options), Highcon Euclid III, Zünd S3
- HP Production Pro 6.0.1, HP Production Center 2.5.1 beta, Apogee 9.1, Enfocus Switch 13u1 & PitStop Server 13u2.

Chat: open-automation @ gitter
User avatar
gabrielp
Advanced member
Posts: 577
Joined: Fri Aug 08, 2014 4:31 pm
Location: Boston
Contact:

Re: Making a folder on Windows with Script Scripter

Post by gabrielp »

Doh! Here's a better way using the Switch Directory class:

Code: Select all

if(!thatDir.exists){
		thisDir.mkdir(that);
	}
Chat: open-automation @ gitter
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
Post Reply