cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • DownloadSemiconductor Toolkit: Tools to create wafer maps, add wafer geometry to graphics, explore die defects & compare wafers.
  • Discovery Summit 2026: Early User Edition - September 23-24.Register. It's free.
  • Use JMP Clinical with CDISC-compliant data. Review studies, ID safety and efficacy signals & communicate findings with interactive graphics. Register to see how. Aug. 27, 2 pm US ET.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
vishwasanj
Level V

Delete files in a folder

Hi All,

 

Is there a way to delte all .txt,.csv,.jrn and .png files in a folder before running a script to repopulate everything?

 

I do want to keep my. json file in the same folder.

 

Thank you so much. I really appreciate your time and effort.

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Delete files in a folder

Oops, the word() functions reference should have been

If(word(-1,Y[i],".") == "txt"

negative values indicate to count from the right, positive values count from the left

Go to

     Help==>Scripting Index==Functions==>Character==>Word

for documentation and example

Jim

View solution in original post

3 REPLIES 3
txnelson
Super User

Re: Delete files in a folder

You can use

Y = Files In Directory( <Path"=> );

to get the files, and then loop through the list of files and determine if the file is of the type you want to delete, and then delete it 

If(word(=1,Y[i],".") == "txt",
    r= Delete File(<path> || Y[i]);
);
Jim
vishwasanj
Level V

Re: Delete files in a folder

Is there a way to count from the left as I have "." in the name also?
txnelson
Super User

Re: Delete files in a folder

Oops, the word() functions reference should have been

If(word(-1,Y[i],".") == "txt"

negative values indicate to count from the right, positive values count from the left

Go to

     Help==>Scripting Index==Functions==>Character==>Word

for documentation and example

Jim

Recommended Articles