r/applescript • • Oct 03 '22

Move file into folder of same name

I have a folder called Movies. Inside there are files

movie1.mp4

movie2.mp4

movie3.mp4

I want each file to be placed inside a folder of the same name (without the extension).

The end result would be a folder named Movies with 3 folders

movie1

movie2

movie3

And in each of the folder would be the respective movie#.mp4 file

4 Upvotes

13 comments sorted by

View all comments

Show parent comment

1

u/copperdomebodha Oct 09 '22 edited Oct 09 '22

I have to put text here to convince Reddit to update this post because it doesn’t count adding only spaces as a valid edit.

Set text item delimiters to “.”
Set thefilename to (text items 1 thru -2 of thefilename) as text

That would reconstruct the file name removing only the final period-delimited element.