Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Hello,

In scriptmaster I found the script DeleteFileOrFolder ; I can't find how to pass jokers to delete all files in the folder without deleting the folder itself.

Indeed I saw that there's also a script to create folder, but it would be great if there's a possibility to perform that in only one command.

Thanks for your help !

Noël

I just played around with delete all day

If you create a script with the following code it passes the contents of a directory

// ListDirectory (fm)Directory)

// lists all files in a directory



def list = []

//eachFile() returns a list of objects

//is.Directory() returns if it is file or directory

new File(fm_Directory).eachFile{ if( it.isDirectory() ) {

	list == list

	} else {

	list<< it.absolutePath

	}

}



return list




it will give you back a list of {everything} all files



//edited this now gives system path so the next para is redundant

use Filemaker to loop through the list and remove every item that does not have a "." at the end and at the same time add the fm_Directory to the start of each value - am sure someone cleverer than me already might have code for that...





Then pass the resultant list to this




// Delete( fm_Filelist)

// param List() with valid system paths to files

// Deletes all the list

// Returns 2 if all done, 1 if partially done and 0 if no files deleted



files = (fm_Filelist)

list = files.split("n")

flag2 = 0

flag = 0

list.each { item -> 

File file = new File("${item}")

success = file.delete()

	if (!success) {

		flag2 = 1

	} else {

		flag = 1

	}

}

if ( flag2 == 1) {

	if (flag == 1 ) {

		return true

	} else {

		return false

	}

} else {

	return 2

}

this needs some work obviously but as you have got the list from a function in the first place it should only have legal values anyway

Edited by Guest

  • Author

Hello John

Your solution works fine an I thank to to have "played" with that !

It requires also two scripts ; I imagined that it was possible to pass the list as a *.* or at least in my problem an *.jpg

Thanks and regards

That must be quite easy to do.

It should be possible to pass a file mask and then when the list is built to delete all members in one go. Will have a play tomorrow. Unless someone else wants to....

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.