Copy link to clipboard
Copied
Hello,
I am working through my first extend script.
FrameMaker 12
Windows 10
Given a specified path (say "C:\MyFiles\FM_Format") containing a list of *.fm files which belong to a frame maker book, I want to save a *.mif copy of these files into a different folder (C:\MyFiles\MIF_Format).
I've figured out how to iterate over an open book, open each file and how to save the file as an mif file.
What remains for me to do is
1. Determine if the MIF_Format exists.
2. If it does not then create it.
3. Otherwise, clear all the files in that folder (delete them).
I have seen another post indicating that I could write a batch file to perform these three tasks and then I could invoke this batch file from within the script, which is great. I was just curious to know if there were native functions that could perform the same?
Thanks for any feedback.
Egan.
Copy link to clipboard
Copied
Hi Egan,
Dealing with files and folder is explained in the Javascript Tools Guide CC in Chapter 3 (File System Access).
You can find it in ESTK -> Help -> Javascript Tools Guide CC
Here is an example how you can delete files and folders:
Folder must be empty !!!
//delete file
var MyFile = new File ("C:\\deletetest\\test.txt");
if (MyFile.exists)
{
MyFile.remove();
}
//delete folder - folder MUST be empty
var MyFolder = new Folder ("C:\\deletetest");
if (MyFolder.exists)
{
MyFolder.remove();
}
Hope that helps.
Copy link to clipboard
Copied
Hi Sir Not Delete folder incude file
Copy link to clipboard
Copied
To delete a folder + all files + all subfolders just have a look here:
https://community.adobe.com/t5/framemaker/afile-remove-not-working-as-expected/m-p/8143478?page=1