help pls looking for filename ending in _fin.pdf then copying to another folder
can someone help me with an applescript to look for a filename ending in _fin.pdf then copy it to another folder
thanks
KLESSER
Mac Pro
can someone help me with an applescript to look for a filename ending in _fin.pdf then copy it to another folder
thanks
KLESSER
Mac Pro
hello tony, can you help me out again?
this script is great, although one of the destinations is a postcript printer hot folder, and is producing slightly different results compared to previous printed files which were printed through acrobat using a Postcript printer driver. Do you know if there is a way of implementing a PPD to the script?
thanks
KL
Kevlesser wrote:
Do you know if there is a way of implementing a PPD to the script?
Do you mean test for files that have a PPD extension?
If so, just add another elif to the script:
if [ "${i##*_}" = "fin.pdf" ] ; then
if [ ! -d "$DestFolder" ] ; then
mkdir -v "$DestFolder"
fi
cp -n -v "$i" "$DestFolder"
mv "$i" "${i%.*}"_Copied.pdf
elif [ "${i##*_}" = "fin.ppd" ] ; then
if [ ! -d "$DestFolder" ] ; then
mkdir -v "$DestFolder"
fi
cp -n -v "$i" "$DestFolder"
mv "$i" "${i%.*}"_Copied.ppd
can you tell me, why the script would turn the file to fin_c after copy BUT not go to the destination?
Kevlesser wrote:
can you tell me, why the script would turn the file to fin_c after copy BUT not go to the destination?
It should move it.
Run the script in Terminal and look for any error messages.
in fact it goes to dest2 but not 1!
any clues?
Kevlesser wrote:
in fact it goes to dest2 but not 1!
any clues?
What do you see when run in Terminal? (you should see an error message)
(Open Terminal, and drag the script to it, then press enter)
permission denied
Kevlesser wrote:
permission denied
You need to set the Permissions for that Folder.
permissions are all ok. this dest is a shared drive, when i drag and drop files to it it performs correctly, when i use script it turns file to _c but does not copy to mount.
Kevlesser wrote:
permissions are all ok. this dest is a shared drive, when i drag and drop files to it it performs correctly, when i use script it turns file to _c but does not copy to mount.
Try the copy from Terminal:
Enter cp -v then [space], then drag the file to the Terminal window, then [space], then drag the destination folder to the Terminal window, then [enter]
by dragging the destination to terminal it actually gave me a clue. terminal named the path XEROXLASERS-1, althought the smb mount on mac is just XEROXLASERS. i adjusted the script and all works again. thanks.
KL
hi tony
script stopped working on one of the macs, i dragged the dest2 onto terminal and it said it was MICRA PORTAIT-2, i had this problem a month or so ago, and it was a -1, can you tell me what the -1 and -2 means?
thanks
KL
Kevlesser wrote:
…can you tell me what the -1 and -2 means?
That will occur if you have duplicate volume names. OS X will append a -1, -2, -3, etc. when there is more than one MICRA PORTAIT
hi tony
this is the last script we have been using.
#!/bin/bash
DestFolder=/Volumes/XEROXLASERS
DestFolder2=/Volumes/Micra\ Portrait-1
function walk_tree {
local directory="$1"
local i
for i in "$directory"/*;
do
if [ "$i" = . -o "$i" = .. ]; then
continue
elif [ -d "$i" ]; then
walk_tree "$i"
else
if [ "${i##*_}" = "fin.pdf" ] ; then
if [ ! -d "$DestFolder" ] ; then
mkdir -v "$DestFolder"
fi
cp -n -v "$i" "$DestFolder"
mv "$i" "${i%.*}"_c.pdf
elif [ "${i##*_}" = "finl.pdf" ] ; then
if [ ! -d "$DestFolder" ] ; then
mkdir -v "$DestFolder"
fi
if [ ! -d "$DestFolder2" ] ; then
mkdir -v "$DestFolder2"
fi
cp -n -v "$i" "$DestFolder"
cp -n -v "$i" "$DestFolder2"
mv "$i" "${i%.*}"_c.pdf
rm "$DestFolder2"/.DS_Store
fi
fi
done
}
walk_tree /Volumes/SPLASH/Kevin\ Lesser # No trailing slash!
If i wanted to add another file ending to send to another device, can you tell me where i need to add, it will be a file ending _fini.pdf and will go to destfolder3=/Volumes/SRA3 Business Cards
note: this file name only goes to 1 destination
thanks
KL
Kevlesser wrote:
If i wanted to add another file ending to send to another device, can you tell me where i need to add, it will be a file ending _fini.pdf and will go to destfolder3=/Volumes/SRA3 Business Cards
note: this file name only goes to 1 destination
thanks
KL
Just need to define the variable and add another elif:
#!/bin/bash
DestFolder=/Volumes/XEROXLASERS
DestFolder2=/Volumes/Micra\ Portrait-1
Destfolder3=/Volumes/SRA3\ Business\ Cards
function walk_tree {
local directory="$1"
local i
for i in "$directory"/*;
do
if [ "$i" = . -o "$i" = .. ]; then
continue
elif [ -d "$i" ]; then
walk_tree "$i"
else
if [ "${i##*_}" = "fin.pdf" ] ; then
if [ ! -d "$DestFolder" ] ; then
mkdir -v "$DestFolder"
fi
cp -n -v "$i" "$DestFolder"
mv "$i" "${i%.*}"_c.pdf
elif [ "${i##*_}" = "finl.pdf" ] ; then
if [ ! -d "$DestFolder" ] ; then
mkdir -v "$DestFolder"
fi
if [ ! -d "$DestFolder2" ] ; then
mkdir -v "$DestFolder2"
fi
cp -n -v "$i" "$DestFolder"
cp -n -v "$i" "$DestFolder2"
mv "$i" "${i%.*}"_c.pdf
rm "$DestFolder2"/.DS_Store
elif [ "${i##*_}" = "_fini.pdf" ] ; then
if [ ! -d "$DestFolder3" ] ; then
mkdir -v "$DestFolder3"
fi
cp -n -v "$i" "$DestFolder3"
fi
fi
done
}
walk_tree /Volumes/SPLASH/Kevin\ Lesser # No trailing slash!
help pls looking for filename ending in _fin.pdf then copying to another folder