cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Unable to Delete folder created by script in Repository

SwapnilP
12-Amethyst

Unable to Delete folder created by script in Repository

SwapnilP_0-1593000533550.png

I have used ExportSourceControlledEntitiesToZipFile method to Export Project Data to Zip file in Folder. 

 

I am getting below error if I try to open that folder also.

SwapnilP_1-1593000755398.png

ACCEPTED SOLUTION

Accepted Solutions
PaiChung
22-Sapphire I
(To:SwapnilP)

Most likely the @ is the issue.

I'd recommend rewriting your script to create folders without special characters.

Go onto the server directly to remove this folder.

 

If you don't have direct server access, you can do some research into escape characters and try to delete it with an escape character at least for the @ symbol

What I'm not sure is if you need to do a URL escape %40 or force it into the jscript as a string. You may have to do it through a service though not the direct execute of the filerepository service

View solution in original post

5 REPLIES 5
PaiChung
22-Sapphire I
(To:SwapnilP)

Most likely the @ is the issue.

I'd recommend rewriting your script to create folders without special characters.

Go onto the server directly to remove this folder.

 

If you don't have direct server access, you can do some research into escape characters and try to delete it with an escape character at least for the @ symbol

What I'm not sure is if you need to do a URL escape %40 or force it into the jscript as a string. You may have to do it through a service though not the direct execute of the filerepository service

SwapnilP
12-Amethyst
(To:PaiChung)

Yes Removing @ from Foldername works.

 

Is there any way to rename zip file generated by ExportSourceControlledEntitiesToZipFile method ?

Currently its taking Projectname by Default and Overwrites if exported on same location. I don't want it to overwrite but create new zip if export service is run again.

 

Manual Export Allows scope to name the zip so there should be way.

SwapnilP_0-1593004921822.png

 

PaiChung
22-Sapphire I
(To:SwapnilP)

Don't think there are options in the unzip command, so I would recommend to anticipate the overwrite and place them in differently named folders from the start.

SwapnilP
12-Amethyst
(To:PaiChung)

Hi @PaiChung 

 

I found way to rename file. Its working If I execute rename service from SystemRepository thing but if same method is in Script then it doesn't rename. I am using Below code.

 

Things["SystemRepository"].RenameFile({
path: "/" + destinationpath + "OEE.zip" /* STRING */,
name: zipfilename /* STRING */,
overwrite: True /* BOOLEAN */
});

 

I have tested all variables are correct. 

PaiChung
22-Sapphire I
(To:SwapnilP)

Not exactly sure what might be the issue sorry, either not treating it as a string, or maybe filtering out characters that aren't permitted.

Announcements


Top Tags