Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Can we create a folder in tmp location using javascript or any other way?

Avatar

Avatar
Validate 1
Level 2
sanketp67190370
Level 2

Likes

4 likes

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
sanketp67190370
Level 2

Likes

4 likes

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile
sanketp67190370
Level 2

27-03-2019

Hi,

Want to create a folder in the tmp location, How can we create it? javascript or any other way to create the folder?. And after creating the folder want to push some exported packages in that folder and then zip the folder.

Regards,

Sanket Phawde

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Springboard
MVP
Florian_Courgey
MVP

Likes

93 likes

Total Posts

87 posts

Correct Reply

19 solutions
Top badges earned
Springboard
Validate 1
Establish
Contributor
Ignite 1
View profile

Avatar
Springboard
MVP
Florian_Courgey
MVP

Likes

93 likes

Total Posts

87 posts

Correct Reply

19 solutions
Top badges earned
Springboard
Validate 1
Establish
Contributor
Ignite 1
View profile
Florian_Courgey
MVP

27-03-2019

Hi,

you can use the standard linux API:

var folder = execCommand('mktemp -d', true); // [0, "/tmp/tmp.0351385kt "]

folder = folder[1].trim(); // remove any whitespace

logInfo('folder '+folder);

execCommand('touch '+folder+'/myfile1', true); // create some files in the folder

execCommand('touch '+folder+'/myfile2', true);

var zip = execCommand('zip '+folder+'/myzip.zip '+folder); // [0, ""]

logInfo(zip[1]);

var ls = execCommand('ls -alh '+folder); // [0, "myfile1 myfile2 myzip.zip"]

logInfo(ls[1]);

Reference:

- Linux zip https://linux.die.net/man/1/zip

- Linux mktemp https://linux.die.net/man/1/mktemp

- ACC execCommand

Answers (0)