[allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => rottmanja [ip] => webforumsuser@m [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 1 [islastshown] => [isfirstshown] => 1 [attachments] => [allattachments] => ) --> DirectoryExists Function - Coldfusion - Advanced Techniques

DirectoryExists Function - Coldfusion - Advanced Techniques

I am writing an app for a paperless system , and I have the need to check to see if a directory exists and a file exists before writing to the server. The issue I am having is that when I run the code I have paseted I get the following error. I have the pathnames/files names vared out for dynamic processing. I have attached my code. Error -- Invalid CFML construct found on line 42 at column 34. ColdFusion was looking at the following text: # The CFML compiler was processing: * an expression beginning with "DirectoryExists", on line ...

  1. #1

    Default DirectoryExists Function

    I am writing an app for a paperless system , and I have the need to check to
    see if a directory exists and a file exists before writing to the server. The
    issue I am having is that when I run the code I have paseted I get the
    following error. I have the pathnames/files names vared out for dynamic
    processing.

    I have attached my code.

    Error --

    Invalid CFML construct found on line 42 at column 34.
    ColdFusion was looking at the following text:

    #

    The CFML compiler was processing:

    * an expression beginning with "DirectoryExists", on line 42, column
    7.This message is usually caused by a problem in the expressions structure.
    * a cfif tag beginning on line 42, column 2.
    * a cfif tag beginning on line 42, column 2.
    * a cfif tag beginning on line 42, column 2.
    * a cfif tag beginning on line 42, column 2.


    The error occurred in
    /var/www/html/hs2f/paperless/scripts/bck_paperless_read.cfm: line 42

    40 : <cffile action="read" file="#outputPath#" variable="barCode"/>
    41 : <cfif #barCode# contains "#getInfo.fld_salePrefix#" or
    "#getInfo.fld_listPrefix#" or "#getInfo.fld_rentPrefix#">
    42 : <cfif DirectoryExists(#storePath##getInfo.fld_officeCode #/#barCode#) or
    fileExists(#storePath##getInfo.fld_officeCode#/#barCode#/#barCode#.tif)>
    43 : <cffile action="rename" source="#readImgPath.name#"
    destination="#storePath##getInfo.fld_officeCode#/#barCode#/#barCode#-#hash(today
    Date, "MD5")#.tif" mode="777">
    44 : <cfelse>


    <cfquery name="getInfo" datasource="#application.dsn#">
    select * from tbl_smartPanel_branchList
    where fld_paperEmail = '#getMail.from#'
    </cfquery>

    <!--- Reads file names in img path --->
    <cfdirectory action="list" directory="#imgPath#" name="readImgPath">

    <!--- Sets Intial file name --->
    <cfset mainFax = "#readImgPath.name#">

    <!--- Splits tiff files using gnu tiffsplit --->
    <cfexecute name="#tiffsplit#" timeout="40"
    arguments="#imgPath##readImgPath.name# #imgPath#1" outputfile="#logs#" />

    <!--- Deletes intial fax from server --->
    <cffile action="delete" file="#imgPath##mainFax#" />

    <!--- Starts barcode reading loop, based on cfdirectory call --->
    <cfloop query="readImgPath" startrow="1" endrow="#readImgPath.RecordCount#">

    <!--- hs-DME-0.1.51.jar -- Reads 2d Datamatrix barcodes --->
    <cfexecute name="#jPath#java" timeout="40" arguments="-jar #jarPath##bin# -f
    #readImgPath.name#" outputfile="#outputPath#" />

    <!--- Reads the output file for the barcodes --->
    <cffile action="read" file="#outputPath#" variable="barCode"/>

    <cfif #barCode# contains "#getInfo.fld_salePrefix#" or
    "#getInfo.fld_listPrefix#" or "#getInfo.fld_rentPrefix#">

    <cfif DirectoryExists(#storePath##getInfo.fld_officeCode #/#barCode#) or
    fileExists(#storePath##getInfo.fld_officeCode#/#barCode#/#barCode#.tif)>

    <cffile action="rename" source="#readImgPath.name#"
    destination="#storePath##getInfo.fld_officeCode#/#barCode#/#barCode#-#hash(today
    Date, "MD5")#.tif" mode="777">

    <cfelse>

    <cfdirectory action="create"
    directory="#storePath##getInfo.fld_officeCode#/#barCode#/" mode="777">

    <cffile action="rename" source="#imgPath##readImgPath.name#"
    destination="#storePath##getInfo.fld_officeCode#/#barCode#/#barCode#.tif"
    mode="777">
    </cfif>

    <cfelseif
    fileExists(#storePath##getInfo.fld_officeCode#/#barCode#/#barCode#.tif) >

    <cffile action="rename" source="#readImgPath.name#"
    destination="#storePath##getInfo.fld_officeCode#/#barCode#/#barCode#-#hash(today
    Date, "MD5")#.tif" mode="777">

    <cfelse>

    <cffile action="rename" source="#imgPath##readImgPath.name#"
    destination="#storePath##getInfo.fld_officeCode#/#barCode#/#barCode#.tif"
    mode="777">

    </cfif>

    </cfloop>

    rottmanja Guest

  2. #2

    Default Re: DirectoryExists Function

    Hi

    Have you tried putting double quotes around the directory name and file name within the commands
    eg. directoryExists("#dir#") and fileExists("#file#")

    Z
    zoeski80 Guest

  3. #3

    Default Re: DirectoryExists Function

    <cfif DirectoryExists("#storePath##getInfo.fld_officeCod e#/#barCode#") or
    fileExists("#storePath##getInfo.fld_officeCode#/#barCode#/#barCode#.tif")>

    OR

    <cfif DirectoryExists(storePath & getInfo.fld_officeCode & "/ "barCode") or
    fileExists(storePath & getInfo.fld_officeCode & "/" & barCode & "/" & barCode &
    ".tif")>

    Stefan Guest

Similar Threads

  1. Replies: 5
    Last Post: June 27th, 02:12 AM
  2. #25866 [NEW]: Using error_reporting() function don't change output of phpinfo() function
    By sfournier at dmsolutions dot ca in forum PHP Development
    Replies: 0
    Last Post: October 14th, 04:26 PM
  3. note 33714 added to function.register-tick-function
    By icy2@bol.com.br in forum PHP Notes
    Replies: 0
    Last Post: July 4th, 06:21 PM
  4. note 33575 added to function.register-shutdown-function
    By jules@sitepointAASASZZ.com in forum PHP Notes
    Replies: 0
    Last Post: July 1st, 05:41 AM
  5. Replies: 0
    Last Post: July 1st, 12:31 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •