【问题标题】:how to check a directory exist and can write file如何检查目录是否存在并可以写入文件
【发布时间】:2015-06-18 11:11:21
【问题描述】:
  1. 我需要检查目录 test_file 是否存在,如果是,则需要检查目录 test_file 是否具有写入权限,以便将文件写入相同的位置。

我在 shell 脚本(ksh)中需要这个功能。

  1. 当由于
  2. 而出现错误时,对于单表加载和多表加载方法,sqlldr 的返回码是什么

i.logon 问题

二。表不存在

iii.less 列数/数据问题

iv.如果任何错误的文件生成

【问题讨论】:

    标签: oracle shell unix sql-loader


    【解决方案1】:

    检查目录是否存在

    if [ -d "$YOUR_DIRECTORY" ]
    then
    #Operation when directory is present
    else
    #Operation when directory is not present
    fi
    

    用于检查目录是否可写

    if [ -w "$YOUR_DIRECTORY"] 
    then 
    #Operation when directory is writeable
    else
    #Operation when directory is not writeable
    fi
    

    关于Oracle错误码,有环境的可以自行尝试。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-09-11
      • 2017-06-08
      • 1970-01-01
      • 2015-03-16
      • 2013-03-05
      • 1970-01-01
      • 2021-09-19
      • 1970-01-01
      相关资源
      最近更新 更多