• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Delete smart object Photoshop files in TemporaryItems folder

Participant ,
Dec 05, 2016 Dec 05, 2016

Copy link to clipboard

Copied

When you open a smart object in a Photoshop document, a new PSB file is created in your TemporaryItems folder. If you open a lot of smart objects in that document, your hard drive could eventually run out of space.

I know that closing the document will delete these temporary Photoshop files. But, is it possible to delete these temp files, through ExtendScript, without closing the document?

Unfortunately the purge method doesn't clear these files.

app.purge(PurgeTarget.ALLCACHES)

Any ideas?

Thanks!

PS. I'm running Photoshop 2015.0

TOPICS
Actions and scripting

Views

3.3K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , Dec 06, 2016 Dec 06, 2016

I am using code like this:

var deleteFile = new File("C://yourPath//something//something.psb");

     deleteFile.remove();

     deleteFile.close();

Votes

Translate

Translate
Adobe
Community Expert ,
Dec 05, 2016 Dec 05, 2016

Copy link to clipboard

Copied

When you Close  the document that you opened a smart Object layers object from. Photoshop should delete the temp work PSB file as you wrote. When you open the Object Photoshop creates that temp work PSB when you  update the work document close and save it. Photoshop Updated the smart object layer object using the temp file.  Photoshop does not delete that file at that point In case you open and edit the object again. Photoshop will reuse that temp file for you to work on the object again.  When you close the File with the Smart Object layer Photoshop should delete the temp PSB file as you know. If you delete that file before you close the document with the smart object before Photoshop does and the edit the object again you may mess up Photoshop for it had created that file and want to reuse it. If you do not reopen it Photoshop will still try to delete the work file when you  What happens if you deleted it.close the document with the smart object.

If I were you I would open a smart object update the work document close and save it. So the smart object gets updated. Delete the work file manually if you can Photoshop may be holding a lock on it.  If you can delete it.  Open the smart object again  see if Photoshop is OK.

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 05, 2016 Dec 05, 2016

Copy link to clipboard

Copied

Hey JJMack​, thanks for the fast reply!

I understand the purpose of the temporary files. It speeds things up if you need to reopen the smart object. However, I need to delete them because I'm opening a lot of smart objects in the same document.

Deleting the PSB file manually doesn't break anything, and the file isn't locked either. If I manually delete it from the temp folder, Photoshop will simply create a new one when you open the smart object again.

I can manually delete the files with a system command, but I was wondering if Photoshop had a function in its API to perform this action.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 06, 2016 Dec 06, 2016

Copy link to clipboard

Copied

The only thing I could think of is a close event. However events are triggered after the fact not before, Therefore the the document would no longer be open in  Photoshop open documents array.  I would not know how you would be able to find the backing file was one of those temp work document,

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 06, 2016 Dec 06, 2016

Copy link to clipboard

Copied

Yeah the event is only triggered once the document is closed.

I can get the path to the file once the smart object is open. Once I close the smart object, I can just delete it using that path.

I can't think of a reason why Photoshop wouldn't have this functionality implemented. But I guess if it's not part of the "purge" method, then it might not be possible to do it from ExtendScript.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 06, 2016 Dec 06, 2016

Copy link to clipboard

Copied

I am using code like this:

var deleteFile = new File("C://yourPath//something//something.psb");

     deleteFile.remove();

     deleteFile.close();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 06, 2016 Dec 06, 2016

Copy link to clipboard

Copied

LATEST

Yes, that seems to be the best solution since Photoshop doesn't have a native way of doing it.

Thanks guys!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines