How to tell if item is a folder or volume with applescript or shell script?
I am working on a service in Automator that will eject the selected drive when it is finished. Unfortunately automator can only tell the difference between files and folders for the service menu.
Im wondering if if i can use an applescript or shell script that would check if the selected folder is a volume or folder and quit the action if its a folder. I figure the best way to do this is have it determine if the items path is in /Volumes/, but i am completely new to the process and have no idea how to do this.
My automator workflow looks like:
Ask for Confirmation
Get Selected Finder Items
Shell Script
I have the path of the folder selected being passed into the shell script, but after its in there i dont know how to determine if its a volume or not.
Thanks!
K T,
I completely missed that section of the forums, sorry
Neil,
I had that kind of script set up but it was like this:
on run {input, parameters}
tell application "Finder"
kind of item parameters
end tell
end run
And i just figured out that i had to change the first line to "on run {parameters}" and now it works great.
Thanks for the help, it got me going in the right direction
Similar Messages
-
How to search content items in the folder( include subfolders) with API?
I want use UCM API to search contents in the folders including subfolders. I need a example code. thank you !
If you have Folders properly installed, Standard Search form will have 'Folder' field and 'Include subfolders' check box. This means that you can use normal http function call to get results.
Example:
http://content.ravenna.com/idc/idcplg?IdcService=GET_SEARCH_RESULTS&QueryText=&SearchQueryFormat=UNIVERSAL&ftx=&AdvSearch=True&folderChildren=7&ResultCount=20&SortField=dInDate&SortOrder=Desc -
How to report all items in a folder, including subfolders?
I've got a folder structure like this:
Examples
Product1
Ver1_0
Ver1_2
Product2
ver5_5
Ver6_0
How do I generate a Report that lists all items in a certain
subfolder, including all subfolders?
For instance how to list all items in the Examples folder and
below (e.g all items), or how to list all items for the
folder /Examples/Product1 and below?
I need to provide a read-only view of the items in a report etc
for one user-group. There might be a better way than a
report...!?The spaces in the folder structure got stripped off...
Trying to show it by prepending >'s instead of spaces to show
the hierarchy:
Examples
Product1
Ver1_0
Ver1_2Product2
Ver5_5
Ver6_0
(I hope u get it) -
How do I organise items in a folder?
How do I organise items in a folder? There is probably a really simply answer! I want to change the order of items listed, but dragging doesnt work...
mrstrong98,
The solution you suggested is indeed the right one. Just a few extra suggestions. When prefixing filenames with numbers for sorting purposes, you should really use leading zeros to assure that they will sort correctly on your mac and any other devices. So, if there is any chance that your book will have more than 9 chapters, then you should number them like this:
01 - My first chapter
02 - Another chapter
03 - Yet another
12 - The last chapter
I would suggest a similar naming scheme for any files that you need to always sort in a particular manner that can't be accomplished with the built in sorts. -
How to delete all items in download folder under bookmark in the shortest time?
I understand that all downloads from internet and yahoo/google mail are stored in the "Download" folder which I see under bookmark when I want to delete. I think that if the download folder is never emptied, then my mac will slow down. Therefore I want to delete these downloads which I have already seen. How do I delete ALL items in the shortest time? Deleting items, even in groups, takes a long time. Is there a method that I can use so that all items in the folder are deleted in one stroke?
Thanks.
UngujaTry (first button on toolbar) Organize > Select All (Command + A) to select all items in the right pane in the Library.
-
How to remove an item in a folder in Reminders on the IMAC
I am trying to remove an item in a folder in Reminders on my IMAC. I tried holding down the control key and clicking on the item. Sometimes I get a pop up menu with the "delete" option. But more often than none when I do this I get a pop up menu to cut, copy etc...not to delete. Why the inconsistencies in holding down the control key and clicking the mouse? Is there another way to remove the item listed in the folder?
Thank you for your help.Hi ly_he,
You have posted the same thread in the chinese forum of WPF, and I have replied. You could see here:
https://social.msdn.microsoft.com/Forums/zh-CN/029bccae-f2f0-4218-980b-2389da8e5d2c/mvvm-wpf-treeview?forum=wpfzhchs
Best Regards,
Xavier Eoro
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Hi All,
I have multiple folders in document library.I want to retrive list item form folder.
Following is snap
I want to get all sub folder and list item in
Sub folder 1.
Any will be help appreciated..
Thanks
Balaji MoreHi Balaji,
If
you want to query all folders and sub folders of a list or document library, you have to define extra query options. If you are working with the object model you have to set the
ViewAttributes property of the SPQuery object as follows:
qry.ViewAttributes = "Scope='Recursive'";
you can use the client 0bject model to get this as well
ClientContext clientContextObj =
new ClientContext("http://Servername/");
List yourDocLib = clientContextObj.Web.Lists.GetByTitle("Shared Documents");
CamlQuery camlQueryObj = new CamlQuery();
camlQueryObj.ViewXml =
@"<View Scope='Recursive' />";
ClientOM.ListItemCollection listItems =
yourDocLib.GetItems(camlQuery);
clientContextObj.Load(listItems);
clientContextObj.ExecuteQuery();
foreach (var item in listItems)
Krishana Kumar http://www.mosstechnet-kk.com -
How to tell which items are in iTunes library on disc but not in program library?
I made a mistake the other night and I deleted some items from my iTunes library ... but NOT from disc.
These items are still in my 65 gig iTunes library on disc. Somewhere.
I'd like to re-add these songs. Is there any way to tell which songs in the iTunes library on disc are not in the iTunes program library?
I don't want to have to add all 65 gigs again and then remove all the duplicates
thanks!You should try dragging some files already in the library into iTunes to see what happens. I just did, and the new iTunes 10.6 seems to be ignoring them. I then made a copy of a file already in the library, and I added both it and the original by dragging and dropping. Only the new file was added. There was no warning about duplicates in either test. So you may be able to drag your whole library back into iTunes.
For when you do want to determine what files on disk aren't in the iTunes library or vice versa, here's one way to do it (if there's an easier way, I'm all ears):
Export your library as a playlist to a text file.
Use a program that can recursively list all your files on disk as full paths and save its output to a text file.
Load the into a decent text editor. I use Notepad++. Then use a regexp search/replace to tidy up the files so that both consist of one fully qualified filename per line.
Sort the files.
Diff the files and examine the differences.
I can do both 4 and 5 in Notepad++. -
How Do I Share items in Shared Folder?
hi
Sorry but I copied a desktop folder to 'Shared Folder' but when I tried to copy to the ew user its said i have insufficient privileges to complete teh task even though I was an administrator?
Can anyone help?
Thanks
ZahidHi Zahid,
When you drop a folder or file into the "shared" folder, you also have to set the privileges of the folder / file, to read only or read and write.
Do this by
1. Select the item to share, click on it > press "Command + I" for info. > you will see in the info. if you have read and write privileges
2. If not, you can change it here by clicking on the arrow pointer next to "Owner, Group and Others" to read and write
3. Now drop the item into the shared folder
4. If this results in the same message, check that the "shared" folder is set properly by using 1. above
Try this, and if any problems, post back.
Regards,
Robert. -
How do I copy items to a folder created earlier in the script?
Hey all.
I am a self-confessed newbie. I have created a workflow that connects to a server and navigations to a particular directory and then creates a folder named via an "Ask for Text" action. However later in the workflow I want to copy template files form another part of the server into the new folder I created.
The problem is I can get it to copy into the same directory as the folder I have created but not into the folder itself?
Any help greatly appreciated
D ^_^Yey. I fixed it myself using "Set Value of Variable" after my intital Folder Creation Workflow.
^_^ -
I tried installing itunes and then copying the old folders, but that does not work. The error msg I received was that it could not find the "source files" for the music.
Select a track with a broken link and press CTRL-I to Get Info. What is the location given on the Summary tab? Look for the actual file and note down its path.
Depending on just how you managed to import your old library it may be that iTunes is slightly confused over the folder layout and thinks your library should be in the new structure while it is, in fact, in the old one. If you can post back both paths I can confirm this and give you a set of steps to resolve everything.
tt2 -
How to use Classes stored in "Classes" folder in JSP with tomcat ?
Hello friends
im using tomcat as server and MySQL as a Backend. now i am using the date calculation in Diff.class files which i have stored in catalina_home/webapps/prj_dev/Prj_files/classes/diff/DIff.class.
now i am getting error that :
Generated servlet error:
Only a type can be imported. diff.Diff resolves to a package
wht i have to do ?I don't include the "classes" word in my import anymore.. Waa.. I'm going nuts.. T.T
Now, I'm trying to use the class through useBean..
this is how my application looks like:
/webapps
-----/hangman-jsp
------------index.jsp
------------/WEB-INF
-------------------web.xml
-------------------MysteryPhrase.java
-------------------/classes
---------------------------/beans
----------------------------------MysteryPhrase.class
-----------/images
-------------------hangman.gif
This is what is in my MysteryPhrase:
package beans;
import java.lang.String;
import java.lang.StringBuffer;
public class MysteryPhrase {
private String answer;
private StringBuffer mysteryPhrase;
private int guesses;
private char[] alphabet;
public MysteryPhrase () {
this.alphabet = new char[26];
public void setMysteryPhrase (String mysteryPhrase) {
this.answer = mysteryPhrase;
this.mysteryPhrase = new StringBuffer(mysteryPhrase.length());
for (int i = 0; i < mysteryPhrase.length(); i++) {
this.mysteryPhrase.setCharAt(i, '_');
public void setGuess (char guess) {
for (int i = 0; i < answer.length(); i++) {
if (answer.charAt(i) == guess) {
mysteryPhrase.setCharAt(i, guess);
guesses++;
public String getMysteryPhrase () {
return mysteryPhrase.toString();
public String getAnswer () {
return answer;
public int getGuesses () {
return guesses;
This is what is in my index.jsp (It is not yet finished..I just started..)
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<jsp:useBean id="phrase" class="beans.MysteryPhrase"/>
<jsp:setProperty name="phrase" property="MysteryPhrase" value="Hello!"/>
<html>
<head>
<title>JSP/JSTL Implementation of Hangman</title>
<style type="text/css">
div {
color: white;
background-color: gray;
position: absolute;
border-style: solid;
border-width: thin;
width: 20%;
height: 30%;
text-align: center;
#guessBoard {
top: 28%;
left: 42%
#mysteryPhraseBoard {
top: 50%;
left: 25%;
z-index: 2;
#statisticsBoard {
top: 57%;
left: 58%;
z-index: 2;
#categoryBoard {
top: 23%;
left: 10%
#hangman {
top: 7%;
left: 70%;
#char {
width: 20px;
body {
background-color: black;
</style>
</head>
<body>
<div id="categoryBoard">
<form method="post">
Please choose a category:
<select name="category">
<option>Category 1</option>
<option>Category 2</option>
<option>Category 3</option>
<option>Category 4</option>
<option>Category 5</option>
<option>Category 6</option>
<option>Category 7</option>
<option>Category 8</option>
</select>
<input type="submit" value="Change"/>
</form>
</div>
<div id="mysteryPhraseBoard">
The mystery phrase is
</div>
<div id="guessBoard">
<form method="post">
Enter a letter: <input id="char" type="text" name="letter"/>
or
Enter a word: <input type="text" name="word"/>
<input type="submit" value="Guess"/>
</form>
</div>
<div id="statisticsBoard">
Guesses: 0
Remaining Letters: 8
</div>
<div id="hangman">
<img src="images/hangman.gif"/>
</div>
</body>
</html> -
How to tell what physical disk is an ASM volume?
Hello all,
I'm trying to install some clusterware. I have attached, a SAN unit, that was previously used for ASM.
After I installed the ASM libs/drivers...I ran oracleasm scandisks, and it found all of them.
I have ASM1,ASM2....ASMn
I thought, "great"..saves me time having to go through, find each disk device and configure them. I don't mind losing data on them.
I'm in the middle of the OUI for cluster install (11Gr2 on RHEL5)...and on the ASM portion (getting ready to create a disk group for the cluster for voting disk, etc)...well, under candidate disks...it shows nothing.
If I click the all disks option..it shows all my oracle volumes...but their status is 'member'. It will not allow me to add them to my to be new disk group.
I'm not sure what to do.
One problem...is that I can't seem to find a way to find out what physical disk device is associated with each ASM disk.
For instance:
oracleasm querydisk ASM33
Disk "ASM33" is a valid ASM disk
It just shows it's a valid disk...but if I wanted to release it, reconfigure it..etc, I don't know what physical disk it is, and I'd like to use the same layout that was used before.
Is there a way to find out what disk (example: /dev/sda12) is associated with ASM33?
I don't see any options listed for this in the man page for oracleasm, and I can't seem to find much documentation for this either...
Thanks in advance,
cayenneWell for this you can use oracleasm querydisk.Using this you can identify which device as marked for asm or not. for example you can see this below example.
[oracle@localhost init.d]$ sqlplus "/as sysdba"
SQL*Plus: Release 10.2.0.4.0 - Production on Thu Jun 3 11:52:12 2010
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select path from v$asm_disk;
PATH
/dev/oracleasm/disks/VOL2
/dev/oracleasm/disks/VOL1
SQL> exit;
[oracle@localhost init.d]$ su
Password:
[root@localhost init.d]# /sbin/fdisk -l
Disk /dev/sda: 80.0 GB, 80000000000 bytes
255 heads, 63 sectors/track, 9726 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 1305 10482381 83 Linux
/dev/sda2 1306 9401 65031120 83 Linux
/dev/sda3 9402 9662 2096482+ 82 Linux swap / Solaris
/dev/sda4 9663 9726 514080 5 Extended
/dev/sda5 9663 9726 514048+ 83 Linux
Disk /dev/sdb: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 4859 39029886 83 Linux
/dev/sdb2 4860 9729 39118275 83 Linux
[root@localhost init.d]# ./oracleasm querydisk /dev/sdb1
Device "/dev/sdb1" is marked an ASM disk with the label "VOL1"
[root@localhost init.d]# ./oracleasm querydisk /dev/sdb2
Device "/dev/sdb2" is marked an ASM disk with the label "VOL2"
[root@localhost init.d]# ./oracleasm querydisk /dev/sda1
Device "/dev/sda1" is not marked as an ASM disk
[root@localhost init.d]#Also in windows :
C:\Documents and Settings\comp>asmtool -list
NTFS \Device\Harddisk0\Partition1 140655M
ORCLDISKDATA1 \Device\Harddisk0\Partition2 4102M
ORCLDISKDATA2 \Device\Harddisk0\Partition3 4102M
NTFS \Device\Harddisk0\Partition4 152617M
C:\Documents and Settings\comp>answered by chinar in thread:how to identify which rawdevice Disk Is named as VOL1 IN ASM from os level -
How to check for Adobe flash Player installed on Mac with Applescript?
Hi All,
I am trying to installl the AdobeFlashPlayer programmatically, before that i need to chk Whether if its already installed?, if yes then i need to get the version of the same. Since flash player will be added as a plugin, i need to chk the same in Safari and Firefox browsers. Pls suggest how to achieve the same using Applescripts (without using SWFObjects).try this:
tell application "System Events"
try
set v to short version of disk item "/Library/Internet Plug-Ins/Flash Player2.plugin"
on error
-- no plugin installed, do whatever
end try
end tell -
"Can't get folder 'a'" Error with Applescript
Here is my complete applescript application. I am supposed to select a series folder, and it goes into the folder and for each season folder does something inside, including grabbing the name of the season folder. But it keep throwing an error on the line set folderName to name of folder aFolder saying it can't get name of folder "a", but the only folders inside the folder I select are Season 1, Season 2, and Season 3. Additionally, looking at the replies part of the script editor it looks like it does "M" first with no errors, and they goes to "a". I have no idea where this is coming from so help me if you can. Disregard the weird formatting, copying everything from the script editor into here messed everything up. Thanks.
set seriesFolder to (choose folder with prompt "Select TV Series Folder") as text
tell application "Finder" to set tvName to "list of " & (name of folder seriesFolder as text) & " episodes"
openWebpage(tvName)
repeat with aFolder in seriesFolder
tell application "Finder"
set folderName to name of folder aFolder
set whichFile to every file of folder aFolder
sort whichFile by name
end tell
set sNumber to "0" & ((characters -1 thru -1 of folderName) as string)
set epNum to 1
repeat with aFile in whichFile
if epNum is less than 10 then
set ifZero to "0"
else
set ifZero to ""
end if
set textBox to "What is episode title for S" & (sNumber as string) & "E" & ifZero & epNum & "?"
tell application "Finder"
set filename to name of aFile
set nameEnding to ((characters -4 thru -1 of filename) as string)
display dialog textBox default answer ""
set text_returned to text returned of result
set name of aFile to "S" & (sNumber as string) & "E" & ifZero & (epNum as string) & " - " & text_returned & nameEnding
end tell
set epNum to epNum + 1
end repeat
end repeat
on openWebpage(input)
set seriesName to input
set needle to " "
set replacement to "+"
set searchName to search_replace(seriesName, needle, replacement)
set address to "http://www.en.wikipedia.org/w/index.php?search=" & searchName & "&title=Special%3ASearch&go=Go"
tell application "Safari" to open location address
end openWebpage
on search_replace(seriesName, needle, replacement)
set old_delimiters to AppleScript's text item delimiters
set AppleScript's text item delimiters to needle
set temp_list to every text item of seriesName
set AppleScript's text item delimiters to replacement
set return_value to temp_list as text
set AppleScript's text item delimiters to old_delimiters
return return_value
end search_replaceTry replacing the beginning of the script with:
set seriesFolder to (choose folder with prompt "Select TV Series Folder")
tell application "Finder"
set tvName to "list of " & (name of folder seriesFolder as text) & " episodes"
tell me to openWebpage(tvName)
repeat with aFolder in (get folders of seriesFolder)
set folderName to name of aFolder
(109908)
Maybe you are looking for
-
How to retrieve client's IP address in servlet
thanks
-
ED values not flowing in Excise Invoice
All excise settings are done. Commercial invoice (billing doc type F2) is coming correctly with proper Excise duty and cess values.But In excise invoice created in reference to the commercial invoice these values (BED, Cess) are not flowing but mater
-
Hi :O) I have created a web service by using Axis' java2WSDL and WSDL2Java - the program contains quite a few packages and complex objects. When I try to fill in the *SOAPBindingImpl.java I get an error, that the types are incompatible. The code: pac
-
ScrollPane can not scroll to the bottom
Help wanted: I am using a scrollPane to display difference colored text which I used canvas to paint the text each time new text appended to it. The problem is the scrollbar can never scoll to the bottom of the ScrollPane's viewport even though I set
-
Backlight problem along with a few others...ideas?
I'm having the classic backlight issue that seems to be getting more frequent (use flashlight to save whatever I'm working on, then close the iBook, reopen, backlight is on again). It also has some issues involving power/batter (i.e. I'll shut it dow