Tearing my hair out on this one -
Im trying to move files, but because of white space in the volume name the mv shell is barfing.
Im running “quoted form of POSIX path of” on relevant paths, but its not taking it.
Interestingly I can make the target directory just fine with
mkdir -p '/Volumes/ComDes DropBox/YourDesktopClutter/Files_2013-02-13_19-12-13/Movies'
Where as this fails:
mv '/Users/comdesadmin/Movies/*' '/Volumes/ComDes DropBox/YourDesktopClutter/Files_2013-02-13_19-12-13/Movies'
If I manually strip the quotes and ‘\’ out the white space it works fine through terminal.
Anyone have a magic bullet here?
Many thanks in advance.
set destinationFolderPath to "/Volumes/ComDes DropBox/YourDesktopClutter/" as string
set destinationFolderName to ("Files_" & (do shell script "date '+%Y-%m-%d_%H-%M-%S'")) as string -- Create daily parent folder
set destinationFolderPath to destinationFolderPath & destinationFolderName as string
set makedir to "mkdir -p" -- make the dir
set moveFiles to "mv -p"
set sourceFolders to {"Movies", "Pictures", "Music"}
set myUser to (path to home folder from user domain) as string
tell application "Finder"
repeat with sourceFolder in sourceFolders
set testSource to (POSIX path of myUser) & sourceFolder as string
--log testSource
set sizeTest to size of (info for testSource)
if sizeTest is greater than or equal to 0 then
do shell script "mkdir -p" & space & quoted form of (destinationFolderPath & (POSIX path of sourceFolder)) -- make directory
tell application "Finder" to set the clipboard to ("mv" & space & quoted form of (testSource & "/*") & space & quoted form of (destinationFolderPath & (POSIX path of sourceFolder))) as text
do shell script "mv -f" & space & (quoted form of (testSource & "/*")) & space & quoted form of (destinationFolderPath & "/" & sourceFolder & "/")
-- results in: mv '/Users/comdesadmin/Movies/*' '/Volumes/ComDes DropBox/YourDesktopClutter/Files_2013-02-13_18-57-43/Movies' - does not work?!
end if
end repeat
end tell
Browser: Safari 537.17
Operating System: Mac OS X (10.8)