Command to establish whether Directory or Link exists?

I need to run a command that checks whether a Directory or Link exists at a specific location, and if it is a directory to rename it.
Any ideas?

While Cole Tierney's style is valid (and I use it myself), sometimes an if/then/else structure is easier to understand
# doing something if a directory or symlink
if [[ -d aname || -h aname ]]; then
dosomething
fi
# renaming a directory
if [[ -d aname ]]; then
mv aname newname
fi
If you do not really care if it is a symlink, but only that it is a directory or a symlink that points to a directory then:
if [[ -d aname ]]; then
dosomething because aname leads to a directory
fi
While not always easy to read, the "man bash" man page will give you the -d and -h test options along with a long list of other tests you can do on files.
There are also several books on the bash shell, which can be reviewed over a cup of coffee in your local bookstore cafe.

Similar Messages

  • Build error 'CFURLGetFSRef failed - maybe the output directory doesn't exist?' Eclipse

    I downloaded and installed the Adobe InDesign Plug-in Editor as an Eclipse distribution, the InDesign SDK and XCode on my iBook G4 with Mac OS X 10.4.10. Creating an InDesign project works fine. I only have to drag-and-drop elements on a form and add some actions.
    Unfortunately, I can't get the Ant Build working. I followed the video-tutorials on the Adobe labs site, but I'm still getting this error:
    CFURLGetFSRef failed - maybe the output directory doesn't exist?
    The error seems to be in the "/Adobe InDesign CS3 Products SDK/devtools/bin/odfrc-cmd" file. I guess it's a SDK problem.
    Does anyone know what the reason is for this error? And maybe how I can fix it?

    This is the full output.
    "Ld "/id5sdk/build/mac/prj/build/InDesign en InCopy plug-in.build/Default/Debug.build/Objects-normal/ppc/InDesign and InCopy plug-in" normal ppc
    cd /id5sdk/build/mac/prj
    /usr/bin/g++-4.0 -o /id5sdk/build/mac/prj/build/InDesign\ and\ InCopy\ plug-in.build/Default/Debug.build/Objects-normal/ppc/InDesign\ and\ InCopy\ plug-in -L/id5sdk/build/mac/prj/../debug/sdk -L../../../build/mac/debug/packagefolder/contents/macos/libs -F/id5sdk/build/mac/prj/../debug/sdk -F../../../build/mac/debug/packagefolder/contents/macos -F../../../build/mac/debug/packagefolder/contents/Frameworks -filelist /id5sdk/build/mac/prj/build/InDesign\ and\ InCopy\ plug-in.build/Default/Debug.build/Objects-normal/ppc/InDesign\ and\ InCopy\ plug-in.LinkFileList -lPublicPlugIn -framework InDesignModelAndUI -framework Carbon -framework InDesign\ and\ InCopy\ plug-in -arch ppc -Wl,-single_module -install_name InDesign\ and\ InCopy\ plug-in.InDesignPlugin/Versions/A/InDesign\ and\ InCopy\ plug-in -Wl,-Y,1455 -dynamiclib -mmacosx-version-min=10.4 -Wl,-Sp -Wl,-executable_path -Wl,../../../build/mac/Debug/packagefolder/contents/macos -isysroot /Developer/SDKs/MacOSX10.4u.sdk
    ld: can't locate framework for: -framework InDesign en InCopy plug-in
    /usr/bin/libtool: internal link edit command failed"
    Anyone who can help me?

  • Import Error: The root directory does not exist

    Hi,
    I have some isuuses with importing the extended page. When I try to Import it throws an error.
    Root Directory does not exist.
    I am using the following command.
    import c:\jdev\jdevhome\jdev\myprojects\oracle\apps\asn\opportunity\webui\EMCOpptyDetPG.xml -includeSubpackages -validate -rootdir c:\prabhat\Jdev\jdevhome\jdev\myprojects -mmddir C:\prabhat\Jdev\jdevhome\jdev\myhtml\OA_HTML\jrad -userId 1 -username apps -password apps -dbconnection "(description = (address_list = (address = (community = tcp.world)(protocol = tcp)(host =xxxx)(port =xxx)))(connect_data = (sid = xxxx)))" -jdk13
    Importing /oracle/apps/asn/opportunity/webui/EMCOpptyDetPG
    Validation warnings in document "/oracle/apps/asn/opportunity/webui/EMCOpptyDetP
    G":
    Importing /oracle/apps/asn/opportunity/webui/EMCOpptyDetPG
    Validation warnings in document "/oracle/apps/asn/opportunity/webui/EMCOpptyDetPG":
    Invalid value "/oracle/apps/pv/opportunity/webui/PvOpptyPartnerRN" for property
    "Extends" on component "/oracle/apps/asn/opportunity/webui/EMCOpptyDetPG.ASNSubt
    abPrmRN". Component "/oracle/apps/pv/opportunity/webui/PvOpptyPartnerRN" cannot
    be referenced from "/oracle/apps/asn/opportunity/webui/EMCOpptyDetPG.ASNSubtabPr
    mRN" because it violates scope restrictions.
    Invalid value "/oracle/apps/jtf/cac/task/webui/CacTaskSummRN" for property "Exte
    nds" on component "/oracle/apps/asn/opportunity/webui/EMCOpptyDetPG.ASNSubtabTas
    kRN". Component "/oracle/apps/jtf/cac/task/webui/CacTaskSummRN" cannot be refere
    nced from "/oracle/apps/asn/opportunity/webui/EMCOpptyDetPG.ASNSubtabTaskRN" bec
    ause it violates scope restrictions.
    The component "/oracle/apps/asn/opportunity/webui/EMCOpptyDetPG.ASNSubtabTaskRN"
    cannot contain "/oracle/apps/jtf/cac/task/webui/CacTaskSummRN.CacSmrTable" of t
    able style because it is inside "tableLayout".
    The component "/oracle/apps/asn/opportunity/webui/EMCOpptyDetPG.ASNSubtabTaskRN"
    cannot contain "/oracle/apps/jtf/cac/task/webui/CacTaskSummRN.CacSmrTaskButtonR
    N" of stackLayout style because it is inside "tableLayout".
    Invalid value "/oracle/apps/pv/opportunity/webui/PvAbandonOpptyRN" for property
    "Extends" on component "/oracle/apps/asn/opportunity/webui/EMCOpptyDetPG.ASNPrmS
    tack". Component "/oracle/apps/pv/opportunity/webui/PvAbandonOpptyRN" cannot be
    referenced from "/oracle/apps/asn/opportunity/webui/EMCOpptyDetPG.ASNPrmStack" b
    ecause it violates scope restrictions.
    Error: The root directory does not exist
    Error: The root directory does not exist
    Error: The root directory does not exist
    Error: The root directory does not exist
    Error: The root directory does not exist
    Error: The root directory does not exist
    Error: The root directory does not exist
    Error: The root directory does not exist
    Error: The root directory does not exist
    Error: The root directory does not exist
    Error: The root directory does not exist
    Error: The root directory does not exist
    Import completed.
    But After this when I try to see from the server there is no file with name EMCOpptyDetPG.xml exist. So I think this file is not imported.
    Could suggest how to solve this problem.
    Thanks
    Prabhat

    Hi Tapash
    while deploying a page to mds Repository i m getting the same error that root Directory does not exist but it also says that import completed successfully.
    when i see the same using jdr_utils.listDocuments('xxxx/oracle/apps/ak/server/webui/xxxPG')
    it says printing /xxxx/oracle/apps/ak/server/webui/xxxPG thus page is available in the mds repository and i m able to access the page at run time
    my concern is why i m getting this error
    my import command looks like this
    java oracle.jrad.tools.xml.importer.XMLImporter $JAVA_TOP/xxxx/oracle/apps/ak/server/webui/xxxxPG.xml -jdk13 -mmddir $OA_HTML/jrad -username apps -password apps -rootdir $JAVA_TOP -validate -dbconnection " (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = xyxyxyxyxy)(PORT = xyxyx)) (CONNECT_DATA = (SID =yyy)))"
    could u pls suggest some solution.

  • Import Error:Root Directory Does not exist

    Hi,
    I have some isuuses with importing the extended page. When I try to Import it throws an error.
    Root Directory does not exist.
    I am using the following command.
    import c:\jdev\jdevhome\jdev\myprojects\oracle\apps\asn\opportunity\webui\EMCOpptyDetPG.xml -includeSubpackages -validate -rootdir c:\prabhat\Jdev\jdevhome\jdev\myprojects -mmddir C:\prabhat\Jdev\jdevhome\jdev\myhtml\OA_HTML\jrad -userId 1 -username apps -password apps -dbconnection "(description = (address_list = (address = (community = tcp.world)(protocol = tcp)(host =xxxx)(port =xxx)))(connect_data = (sid = xxxx)))" -jdk13
    Importing /oracle/apps/asn/opportunity/webui/EMCOpptyDetPG
    Validation warnings in document "/oracle/apps/asn/opportunity/webui/EMCOpptyDetP
    G":
    Importing /oracle/apps/asn/opportunity/webui/EMCOpptyDetPG
    Validation warnings in document "/oracle/apps/asn/opportunity/webui/EMCOpptyDetPG":
    Invalid value "/oracle/apps/pv/opportunity/webui/PvOpptyPartnerRN" for property
    "Extends" on component "/oracle/apps/asn/opportunity/webui/EMCOpptyDetPG.ASNSubt
    abPrmRN". Component "/oracle/apps/pv/opportunity/webui/PvOpptyPartnerRN" cannot
    be referenced from "/oracle/apps/asn/opportunity/webui/EMCOpptyDetPG.ASNSubtabPr
    mRN" because it violates scope restrictions.
    Invalid value "/oracle/apps/jtf/cac/task/webui/CacTaskSummRN" for property "Exte
    nds" on component "/oracle/apps/asn/opportunity/webui/EMCOpptyDetPG.ASNSubtabTas
    kRN". Component "/oracle/apps/jtf/cac/task/webui/CacTaskSummRN" cannot be refere
    nced from "/oracle/apps/asn/opportunity/webui/EMCOpptyDetPG.ASNSubtabTaskRN" bec
    ause it violates scope restrictions.
    The component "/oracle/apps/asn/opportunity/webui/EMCOpptyDetPG.ASNSubtabTaskRN"
    cannot contain "/oracle/apps/jtf/cac/task/webui/CacTaskSummRN.CacSmrTable" of t
    able style because it is inside "tableLayout".
    The component "/oracle/apps/asn/opportunity/webui/EMCOpptyDetPG.ASNSubtabTaskRN"
    cannot contain "/oracle/apps/jtf/cac/task/webui/CacTaskSummRN.CacSmrTaskButtonR
    N" of stackLayout style because it is inside "tableLayout".
    Invalid value "/oracle/apps/pv/opportunity/webui/PvAbandonOpptyRN" for property
    "Extends" on component "/oracle/apps/asn/opportunity/webui/EMCOpptyDetPG.ASNPrmS
    tack". Component "/oracle/apps/pv/opportunity/webui/PvAbandonOpptyRN" cannot be
    referenced from "/oracle/apps/asn/opportunity/webui/EMCOpptyDetPG.ASNPrmStack" b
    ecause it violates scope restrictions.
    Error: The root directory does not exist
    Error: The root directory does not exist
    Error: The root directory does not exist
    Error: The root directory does not exist
    Error: The root directory does not exist
    Error: The root directory does not exist
    Error: The root directory does not exist
    Error: The root directory does not exist
    Error: The root directory does not exist
    Error: The root directory does not exist
    Error: The root directory does not exist
    Error: The root directory does not exist
    Import completed.
    But After this when I try to see from the server there is no file with name EMCOpptyDetPG.xml exist. So I think this file is not imported.
    Could suggest how to solve this problem.
    Thanks
    Prabhat

    Hi Tapash
    while deploying a page to mds Repository i m getting the same error that root Directory does not exist but it also says that import completed successfully.
    when i see the same using jdr_utils.listDocuments('xxxx/oracle/apps/ak/server/webui/xxxPG')
    it says printing /xxxx/oracle/apps/ak/server/webui/xxxPG thus page is available in the mds repository and i m able to access the page at run time
    my concern is why i m getting this error
    my import command looks like this
    java oracle.jrad.tools.xml.importer.XMLImporter $JAVA_TOP/xxxx/oracle/apps/ak/server/webui/xxxxPG.xml -jdk13 -mmddir $OA_HTML/jrad -username apps -password apps -rootdir $JAVA_TOP -validate -dbconnection " (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = xyxyxyxyxy)(PORT = xyxyx)) (CONNECT_DATA = (SID =yyy)))"
    could u pls suggest some solution.

  • Error in file receiver adapter (Directory does not exist / cannot be create

    I have a NFS reiceiver file NFS adapter with target directory:
    10.128.68.38\arbo2000\UploadPinfos\arbodev
    if I run this line in windows, windows access to this folder.
    Full Error log:
    Receiver Adapter v2123 for Party '', Service 'BS_0000_ARBO_DEV':
    Configured at 2006-04-06 18:08:26 CEST
    History:
    - 2006-04-06 18:08:35 CEST: Error: Message processing failed: Exception: Message processing failed - configuration error in file receiver adapter (Directory does not exist / cannot be created)
    Can somebody help me please??

    Hi Alvaro,
            If your XI server is running on Unix platform then you'll get the access only after mounting 10.128.68.38 this system as a drive. This is equivalent to the windows network mapping.
    Next thing is that once that is done then you can access the path /arbo2000/UploadPinfos/arbodev by mentioning it in your directory path.
    To check whether the above mentioned is the problem then pls do try by doing it with FTP protocol. If it works then for acting as a local directory for NFS you need to mount the drive.
    Cheers
    JK

  • We want to the whether the below functionality exists in SRM

    We want to the whether the below functionality exists in SRM.
    In the shopping cart when we click on the details against any item and get in to the follow-on documents. We have two options. 1) Display as Graphic 2) Display as table.
    When we select graphic display, we get hyperlink for the order number. When we click on this link we get details pertaining to only to that specific item only that too in a tabular form (in the same screen). Is this the standard SRM functionality? Or   is there a way that when we click on this link do we get the PDF copy of the order showing all the items along with terms and conditions whcih can be saved on to our desk top.

    Hi,
    This is the standard behavior. If you click on the item link in SRM 5.0, it will open there in tabular form with less details. In SRM 7.0, if you click on the Related Documents tab and then PO number, system will open the PO in new window where you can Export it to Excel or Print it using Print Preview and then save it in PDF. I don't think in SRM 5.0 if there is functionality to directly save PO in PDF through SC.
    Thanks,
    Anshuk Saxena

  • Try to check whether a file already exists on disk by using fileExists

    Hy all,
    i try to check whether a file already exists on disk in my
    Action scirpt.
    I found this link about fileExists:
    link
    So i tried somethink like this in my code, but without
    success...
    if(fl.fileExists("file:///C|/toto.txt"))
    {gotoAndPlay(2);}
    else
    {gotoAndPlay(3);}
    Is it not the right syntax?
    Thank you for your help.

    Did you build and application from the swf with mProjector?
    The only
    way this and other mProjector functions will get called is to
    post
    process your swf into and application (exe / app) using
    mProjector.
    you can get a free trial here
    http://www.screentime.com/software/mprojector/demo.html
    On 2007-01-08 16:02:42 -0500, "Alexis Schneider"
    <[email protected]> said:
    John Pattenden
    Screentime Media - Flash Tools since 1997
    http://www.screentime.com

  • Use Powershell to check whether and AD user exists

    We're trying to clean up roaming profile folders, and as part of the task I need to check whether the user actually exists in AD.  I have tried 3 different methods and so far none of them work.
    Either the empty result of the search doesn't equal $null (e.g. If ($objUser -eq $null) resolves to false) or Powershell crashes (like when I try to run that If statement).  So is there an AD User equivalent to Test-Path?
    RF

    I should add, if you want to use PowerShell filter syntax, you can use:
    $Name
    = "jsmith"
    $User = Get-ADUser
    -Filter {sAMAccountName
    -eq $Name}
    If ($User
    -eq $Null) {"User does not exist in AD"}
    Else {"User found in AD"}
    And if you only have PowerShell V1, you can use the following:
    $Name =
    "jsmith"
    $Searcher =
    [ADSISearcher]"(sAMAccountName=$Name)"
    $Results =
    $Searcher.FindOne()
    If ($Results
    -eq $Null) {"Users does not exist in AD"}
    Else {"User found in AD"}
    In all cases I assume you are checking the "pre-Windows 2000 logon" name, not the Common Name (the value of the cn attribute, which does not uniquely identify the object in AD).
    Richard Mueller - MVP Directory Services

  • ERROR: Cannot start mail services, configuration directory does not exist

    I'm running an Xserve G5 with one internal boot drive and one RAID using the other two internal drives. I used Apple's Disk Utility to set-up the RAID.
    Back in early December, I moved my mail database and mail store to the RAID. Ever since, when I restart the server, the mailaccess.log generates the following error:
    Jan 23 18:51:33 mail master[47]: ERROR: Cannot start mail services, configuration directory does not exist: /Volumes/RAID/mail.data/db
    I'm speculating this is a timing error that gets created when Postfix initially can't find the RAID. Then, it must try again and find it because the error message does not repeat and mail starts running.
    Is this something to worry about?

    Hi Joel,
    You're right, it's a timing issues. The mail system is ready for work before the file system is mounted. It's benign.
    Jeff

  • Help needed in creating File Directory if not exist

    hi, All
    I am thinking about wite files to directories based on year, month, day. if the directory for that year or month or day exists already, do not create the directory, but write the file to that directory.
    For example: 2003/02/22/file.txt --2003/02/22 exist, just write file.txt
    If the directory does not exist, the program will create the direcotry and write the file into the right directory.
    For example 2003/02/22/file.txt, ---2003/02/22/ does not exist, the program will create the directoies and write file file.txt
    If anyone can provide any example or suggestion, I really appreciate!
    Thanks
    Steve

    Hi!
    Just have a look at the class "File"
    and it's method "exists()".
    Hope, that helps.
    Thoto

  • File adapter : Do not poll if directory does not exist

    Hi people !
    I have a BPEL process that takes files as Input messages.
    I use a file adapter to do that.
    It works well but I would like to avoid polling the directory if it does not exist, do you know how to control if the directory actually exists ?
    Here is the File Adapter configuration :
    <jca:operation
    PhysicalDirectory="PhysDir"
    ActivationSpec="oracle.tip.adapter.file.inbound.FileActivationSpec"
    PhysicalArchiveDirectory="ArchiveDirl"
    DeleteFile="true"
    IncludeFiles=".*\.xml"
    PollingFrequency="30"
    MinimumAge="0"
    OpaqueSchema="false" >
    </jca:operation>
    Even if the directory does not exist, the process endlessly tries to poll that directory.
    Thanks in advance,
    Romain.

    I do agree with you that the directory should exist because the adapter was configured to poll on that directory !!
    Nevertheless, I would like to know how to control its existence before polling...
    Romain.

  • 'Source Directory doesn't exist' error in sender file adapter

    Hi All,
    I m getting the error 'Source Directory doesn't exist' in sender file adapter.
    The source file directory doesn't exist in XI Server. Its in a different system.
    gone through other sdn t hreads.
    the options seems to be
    1. either to mount the Source Directory on the XI Server.
    2. Install a FTP server and use FTP protocol.
    My doubt is that, could nt we give necessary access rights to the XIAFUSER whihc will access the Source Directory?
    Wont it be sufficient?

    Hi Aarthi,
    If you are using system other than XI, then you have to use FTP server
    else check you have proper authorization of read/write to the source directory...
    and check the name of it as well, as it is case sensetive and you have provided the proper details of server.
    check these blog as well...
    /people/venugopalarao.immadisetty/blog/2007/01/24/troubleshooting-file-to-idoc-scenario-in-xi
    /people/shabarish.vijayakumar/blog/2006/08/01/along-came-a-file-adapter-mr-ftp-and-rest-of-the-gang
    Sachin
    Edited by: Sachin Dhingra on Mar 24, 2009 12:16 PM

  • Input File repository server Error: The requested directory does not exist.

    Hi,
    Getting following error "The requested directory does not exist." for Input and Out put file repository server.
    The specfied directory exists and the user has local administrative privelges with full control of the IFRS and OFRS location.
    The location was earlier working and after trying to implement Windows AD the things stopped. Have tried reverting the things but the following issue still persists.
    Thanks,
    Manpreet

    @Siva,
    I am not using the defacult FRS, I have specfied a specfic location on which the user has full control.
    this was working prior to the Windows AD setup tried by me.

  • Error when trying to install the adobe creative suite exit code 39.I get the following error message Directory does not exist : /Applications/Utilities/Adobe Application Manager/DECore/DE6/resources/uninstall/Uninstall Product.app

    i have run the adobe cleaner , repaired disk permission and also tried to download and install several times.
    this is a mac osx running the yoshmite
    please help
    this is the error
    Exit Code: 39
    Please see specific errors below for troubleshooting. For example,  ERROR: DW042 ...
    -------------------------------------- Summary --------------------------------------
    - 0 fatal error(s), 2 error(s)
    ERROR: Directory does not exist : /Applications/Utilities/Adobe Application Manager/DECore/DE6/resources/uninstall/Uninstall Product.app
    ERROR: DW042: ARP Entry couldn't be created for language : en_US

    Oliviat14nov does /Applications/Utilities/Adobe Application Manager/DECore/DE6/resources/uninstall exist on your computer? 

  • CD drive problems "Directory doesn't exist"

    Seems like everybody has some variant of this problem.  I'm having difficulty getting the CD drive to read the disks I put in.  I'm using PCman as my file manager and when I try to access the CD drive I get a pair of error messages that simply say "..."  This is followed by a third error saying "Directory doesn't exist."  My HAL is configured for hotplugging if that matters.
    I've been wrestling with this for a couple days and tried several solutions from both the wiki and the forum.  Any help with fixing, or just suggestions on how to better diagnose the problem would be much appreciated.

    I had this problem using hal, Slim, openbox and pcmanfm. Solved it using this post
    http://bbs.archlinux.org/viewtopic.php?id=65070
    which I found in the Wiki/Table of Contents/Hardware Detection & Troubleshooting/Hal/Permission Denied page.
    I only had to follow the two steps in the PS, after which I could access cd's as normal user.
    Hope this helps.

Maybe you are looking for

  • Problem with printer

    Hi. Till this afternoon it worked perfectly... now, it doesn't work.... In /var/log/cups/error_log  there is: I [07/Oct/2008:23:18:50 +0200] [Job 159] Adding start banner page "none". I [07/Oct/2008:23:18:50 +0200] [Job 159] Adding end banner page "n

  • New field in Activities PCUI CRM 5.0

    Hi SDN, In Activites (under Details Tab)screen we want to have Completion field which is already there in CRM GUI. For Activities(CRMD_BUS2000126), I can see two different Field groups like ACT_DETAIL and ACT_DETAIL_50. and I have found COMPLETION fi

  • Edit menu

    I can't paste, cut, or delete in quicktime Pro?

  • Where is the fod schema

    can someone point me to the fod schema install scripts used for the storefront demo? a found a link that said http://st-curriculum.oracle.com/obe/jdev/obe11jdev/11/common/files/FOD_11.zip but that is giving me a 404 error

  • Download options

    I downloaded the recent firefox browser and now i'm not able to download any music to my itunes player. Before it would give me the option to save the file to itunes or atleast download into the firefox downloads folder but now it plays in a new tab.