mv `ls /Users/johndoe/Desktop/xyz*.pdf | tail -1` /Users/johndoe/Desktop/goal
With "one file" I mean one random file out of more than fifty pdfs... thanks!
@JustMartin / That works great as long as the filename does not contain an empty space character. Any ideas how to solve this? Thank you so much!
shopping list.pdf
shopping\ list.pdf
mv "`ls /Users/johndoe/Desktop/*.pdf | tail -1`" /Users/johndoe/Desktop/goal
In the command line when there is an empty space you need to use the escape character.
So you would enter...
Code:shopping list.pdf
as
Code:shopping\ list.pdf
set myFile to "any file i want.pdf"
set src to "/Users/johndoe/xyz/" & myFile
set src to "/Users/johndoe/goal/" & myFile
do shell script "mv " & (quoted form of src) & " " & (quoted form of trg)