how to get path for multiple files correctly through applescript or through terminal The current script I'm using for getting file path for single selection in finder is 

tell application "Finder"
    set thepath to selection as text
    set pospath to quoted form of the POSIX path of thepath
end tell


It gives me path like this: '/Users/lawsome/Desktop/jan-study/untitled folder/'

This format of path is working for passing single file path for further action like moving or deleting the selected file. 

When I'm trying the same script for multiple selections in finder I get result like this:

'/Users/lawsome/Desktop/Business Org Feedback.pdfMacintosh HD/Users/lawsome/Desktop/Top 10Macintosh HD/Users/lawsome/Desktop/Follow_Up_letters_Samples.pdfMacintosh HD/Users/lawsome/Desktop/Learn Outlook Tips.txtMacintosh HD/Users/lawsome/Desktop/OutlookTips.pdf'


This result doesn't work for me. What I'm trying to achieve is to pass multiple paths for selected finder items for further action.

If I drag multiple files in terminal, it shows files path in a different format and that works for further action. How can I get the path correctly through a script or through a terminal command.
The selection in Finder returns a list, so here is an example of how I'd handle things:

Example AppleScript code:

tell application "Finder"
    set theSelection to selection
    if theSelection is {} then
        return
    else if (theSelection count) is equal to 1 then
        set thePathFilename to the quoted form of POSIX path of (theSelection as string)
    else
        set thePathFilename to {}
        repeat with i from 1 to (theSelection count)
            copy (quoted form of POSIX path of (item i of theSelection as string)) &amp; space to end of thePathFilename
        end repeat
        set thePathFilename to thePathFilename as string
    end if
end tell



If there is no selection when the script runs, it stops processing.
If only one item is in the selection, the thePathFilename contains one quoted POSIX Path Filename of the selected item, as a string.
If more then one item is in the selection, the thePathFilename contains the quoted POSIX Path Filename of each of the selected items, as a string, with a space after each.




Note: The example AppleScript code is just that and does not employ any error handling and is meant only to show one of many ways accomplish a task. The onus is always upon the User to add/use appropriate error handling as needed/wanted.