in below script rm -rf path is problem,
can anyone tell me correct path after rm -rf…
tell application "Finder"
mount volume "afp://advo:password@10.0.0.40/Anup/Temp"
if (exists "Temp") then
do shell script "rm -rf afp://advo:password@10.0.0.40/Anup/Temp/"
end if
end tell
It’s not a POSIX path.
Path should be something like /Volumes//
may I ask what you exactly want to remove?
read post #4 I’ve posted here a way how to mount and unmount volumes properly.
I read your post, I am impressed regarding below line
mount volume "afp://" & user_name & ":" & pass_word & "@3.9.55.1/"
I want to delete all files and folders from main folder Temp in above script
I change to “Volumes/Anup/Temp” but no result and this volume name may change so want to generalise
use mount to determine the path to the volume.
then use rm -Rf /Volumes//*
Or in AppleScript:
set folderVolumes to "/Volumes/" as POSIX file as alias
set volumeNames to list folder folderVolumes without invisibles
If the volume is mounted outside the Finder a user can choose where to mount to and doesn’t need to be in the /Volumes folder at all which is very common with NFS file systems. Also every directory in /Volumes doesn’t always means that the file system is mounted as well. So in my opinion, because of those two arguments, listing /Volumes folder isn’t accurate enough to me.
do shell script “rm -Rf /Volumes/MAC-PRO/Anup/Temp/*.”,this is not deleting files and folders at path
further MAC-PRO is HD name I want to generalise for any mac further not for this mac only, that I am digging but most IMP prob is that Temp is not getting deleted
set folderVolumes to "/Volumes/" as POSIX file as alias
set volumeNames to list folder folderVolumes without invisibles
tell application "Finder"
mount volume "afp://advo:password@10.0.0.40/Anup/Temp"
repeat with theItem in volumeNames
if theItem contains "Anup" then
if (exists "Temp") then
do shell script "rm -Rf /Volumes/MAC-PRO/Anup/Temp/*."
end if
end if
end repeat
end tell
I dont think the path is /Volumes/MAC-PRO/Anup/Temp/ but simply /Volumes/Temp. Even if you have the correct path do shell script “rm -Rf /Volumes/MAC-PRO/Anup/Temp/*.” will only remove will only remove files that ends with a period. So that it won’t remove anything seems normal to me.