Count files in a folder

I want to count the files in a volume. This will tell me how many pictures that i have then as certain actions happen it will automatically add them up for me. First step is finding the corect syntax for the items.

The problem with the above methods is that they could be counting folders/text/exe files etc.
You can control what you want to count with something like this...
app.document.deselectAll();
alert(app.document.getSelection("jpg,pdf,tif").length);
The above will only count jpg, pdf and tif files.

Similar Messages

  • Counting files in a folder and showing results in an alert window.

    Hello all.
    I would like to get the script to count the number of files in a selected folder.
    I have a UI where there are browse, ok and cancel buttons.
    I wanted the OK button to show the number of jpeg files in the selected folder. If no folder is selected, and the OK button is pressed, it would prompt the user to select a folder before pressing the OK button.
    Thanks!

    all you need to learn scripting is in the "JavaScript Tools Guide", you're making some progress but reading that and following the samples will make things clear and speed the learning proccess up.
    if you look at your code there's only one function, it is called when the Browse button is clicked. See how it is constructed and write another similar function for the Ok button, in there read the contents of the label box and create a folder with that path, then call the function to read the files.
    dlg.Panel1.okBtn.onClick = function (){
       selectedFolder = new Folder(decodeURI(dlg.Panel1.Path.text));
       if (selectedFolder.exists)
            doSomething (selectedFolder);
       else
            alert("select a folder first...");
    dlg.center(); //center dialog box on screen
    dlg.show(); //show dialog box
    function doSomething(folder)
            files = folder.getFiles();
            alert(files.length + " Files in selected Folder");
            alert(files);

  • How to count files in a folder and subfolders of the folder.

    Hello everyone,
    I'm having a difficulty with countin files in a Regular folder and subfolders of the folder. I've tried to use SI_ANCESTOR  in a query; however, it gives me innacurate results.
    I used this hierarchy to create the code below, and it works to count all the files:
    Folder A ---> Folder B( subFolder of A)  -
    > Folder C(subFolder of B)  
    //get folder A
    IInfoObjects regFolders = infoStore.query ("SELECT * FROM CI_INFOOBJECTS WHERE SI_KIND='Folder' AND SI_PARENTID=0 AND SI_NAME!='User Folders' Order by SI_NAME");
    IFolder regFolder = (IFolder) regFolders.get(0);     
    //get files from Folder A     
    IInfoObjects rFiles = infoStore.query ("SELECT * FROM CI_INFOOBJECTS WHERE SI_PROGID !   = 'CrystalEnterprise.Folder'   AND SI_PARENTID=" + regFolder.getID() );
    ilesCount += rFiles.size();
    int subCntr=0;
    nt subCntr2=0;
      //get folder B      
    IInfoObjects rSubFolders = infoStore.query ("SELECT * FROM CI_INFOOBJECTS WHERE SI_PROGID = 'CrystalEnterprise.Folder' AND SI_PARENTID=" + regFolder.getID() );
    //get files from subFolders of Folder A
    while (subCntr < rSubFolders.size())
              IInfoObject subFolder=(IInfoObject)rSubFolders.get(subCntr);
              IInfoObjects subFiles = infoStore.query ("SELECT * FROM CI_INFOOBJECTS "
          + " WHERE SI_PROGID != 'CrystalEnterprise.Folder'" AND SI_PARENTID=" + subFolder.getID() );
             filesCount += subFiles.size();
             //get subFolders of Folder B                   
             IInfoObjects rSubFolders2 = infoStore.query ("SELECT * FROM CI_INFOOBJECTS WHERE SI_PROGID = 'CrystalEnterprise.Folder' AND SI_PARENTID=" + subFolder.getID() );
                         //get files from subFolders of Folder B
         while (subCntr2 < rSubFolders2.size())
              IInfoObject subFolder2=(IInfoObject)rSubFolders2.get(subCntr2);
              IInfoObjects subFiles2 = infoStore.query ("SELECT * FROM CI_INFOOBJECTS "
                   + " WHERE SI_PROGID != 'CrystalEnterprise.Folder'  AND SI_PARENTID=" + subFolder2.getID() );
                                               filesCount += subFiles2.size();
               subCntr2++;
              subCntr++;
    As you can see, the code is too complicated, and what if folder C has subFolder?
    I'm guessin maybe recursion would be one way to got, but I'm not really good with it, so I was wondering if anyone has any idea on how to go about doing it.
    Thank you,

    Hi,
    For detailed information, please refer to the BI 4.0 developers guide here.
    You can find the section "Setting up the development environment" in developers guide that have every single instruction to execute a java code specific to BI 4.0 environment.
    Also, here are the instructions for BO 3.1 environment:
    To configure a WAR file for a J2EE application that uses the BusinessObjects Enterprise XI 3.0 and 3.1 Java SDK, complete these steps:
    Create a lib folder in the WAR file's WEB-INF folder.
    Copy the Enterprise XI 3.0 or 3.1 Java SDK JAR files from the appropriate location below to the WAR file's WEB-INF\lib folder:
    Windows:
    ...\Program Files\Business Objects\common\4.0\java\lib
    UNIX:
    <businessobjects_root>/java/lib
    Copy the log4j.jar file from the appropriate location below to the WAR file's WEB-INF\lib folder:
    Windows:
    ...\Program Files\Business Objects\common\4.0\java\lib\external
    UNIX:
    <businessobjects_root>/java/lib/external
    Copy the entire crystalreportviewers12 folder from the appropriate location below to the WAR file's root folder.
    Windows:
    ...\Program Files\Business Objects\common\4.0
    UNIX:
    <businessobjects_root>/enterprise12/JavaSDK
    Open the web.xml file located in the WAR file's WEB-INF folder.
    Specify the location of the utility files used by the report viewers contained in the crystalreportviewers12 folder by inserting the following code below the <display-name> and <description> tags but within the <webapp> tag definition:
    <context-param>
    <param-name>crystal_image_uri</param-name>
    <param-value>/BOXIR3/crystalreportviewers12</param-value>
    </context-param>
    <servlet>
    <servlet-name>CrystalReportViewerServlet</servlet-name>
    <servlet-class>com.crystaldecisions.report.web.viewer.CrystalReportViewerServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>CrystalReportViewerServlet</servlet-name>
    <url-pattern>/CrystalReportViewerHandler</url-pattern>
    </servlet-mapping>
    Deploy the WAR file to the J2EE application server.
    You are now able to run an application using the BusinessObjects Enterprise XI 3.0 and 3.1 Java SDK on a J2EE web application server.
    Hope it helps.
    Regards,
    Anchal

  • Query Count files under Specific folder in Sccm?

    Hello!
    I try to create a Query in sccm. There I want to count files under a specific folder. If folder on the client have less than 35 files, show the name of that computer. How should I begin to create that Query? Should I use criteria Software files Count?
    Greetings
    Emil

    I think for this task you will find it easier to create a report instead. Queries are based on WQL which has some limitations.
    Kent Agerlund | My blogs: blog.coretech.dk/kea and
    SCUG.dk/ | Twitter:
    @Agerlund | Linkedin: Kent Agerlund |
    Mastering ConfigMgr 2012 The Fundamentals

  • How to count files in a folder

    Hello!
    I have a folder with .txt files. If the file name is STRING i need to count all .txt files whose file names contain "STRING".
    For example, if there are STRING.txt, STRING1.txt,STRING2.txt.... in the folder, i need to find out how many of .txt files are there, where substr(filename,0,6)='STRING'
    How can i do this?
    Cheers
    A.

    if it's windows, then this will count the files
    for /f "usebackq tokens=1,2" %i in ( `dir STRING` ) do if '%j'=='File(s)' set file_cnt=%i
    [pre]
    the variable "file_cnt" will have the answer. 
    or the "set" command above could just be an "echo". 
    and of course, in order to do this from pl/sql, you'll need java. 
    you could even change the "set" to an "exit", and the
    file count will be returned as the exit status.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Choose folder and count files : ALIAS returned causes problem

    Hello,
    I have a basic choose folder command and I want to count files contained in the returned folder, I also want to do other things within that folder afterwards.
    Alas, Applescript returns what it calls an ALIAS to the" choose folder" command, so that it can't count anything, it can't even give its REAL name ...
    How could I get the REAL folder as a result , count its items, get its path, instead of that poorly documented ALIAS I can't make anything with ?
    Thanks very much. I've been digging for a while now.

    Use a construct such as:
    set this_folder to choose folder
    tell application "Finder"
    count items of (folder this_folder)
    end tell
    (47355)

  • Script to take every 5th file from a folder and copy it to another folder

    How can I tell applescript to take every 5th file of a folder of say 2000 files and copy them to another location? I want to copy the 5th, 10, 15th, 20th files and so on of 2000 files so I will have only 400 files.
    I guess I want to make a list of all the files and then coerce that to the first and then increments of five but how do I do that?
    Thanks.
    Pedro

    Hi Pedro,
    The following script should do what you are asking for:
    *set theSourceFolder to choose folder with prompt "Select the source folder."*
    *set theTargetFolder to choose folder with prompt "Select the target folder."*
    *tell application "Finder"*
    *set theFiles to files of theSourceFolder*
    *repeat with k from 5 to (count theFiles) by 5*
    *move item k of theFiles to folder theTargetFolder*
    *end repeat*
    *end tell*
    Message was edited by: Pierre L.

  • Script to search all files in specified folder for multiple string text values listed in a source file and output each match to one single results txt file

    I have been searching high and low for this one.  I have a vbscript that can successfully perform the function if one file is listed.  It does a Wscript.echo on the results and if I run this via command using cscript, I can output to a text file
    that way.  However, I cannot seem to get it to work properly if I want it to search ALL the files in the folder.  At one point, I was able to have it create the output file and appear as if it worked, but it never showed any results when the script
    was executed and folder was scanned.  So I am going back to the drawing board and starting from the beginning.
    I also have a txt file that contains the list of string text entries I would like it to search for.  Just for testing, I placed 4 lines of sample text and one single matching text in various target files and nothing comes back.  The current script
    I use for each file has been executed with a few hundred string text lines I want it to search against to well over one thousand.  It might take awhile, but it works every time. The purpose is to let this run against various log files in a folder and
    let it search.  There is no deleting, moving, changing of either the target folder/files to run against, nor of the file that contains the strings to search for.  It is a search (read) only function, going thru the entire contents of the folder and
    when done, performs the loop function and onto the next file to repeat the process until all files are searched.  When completed, instead of running a cscript to execute the script and outputting the results to text, I am trying to create that as part
    of the overall script.  Saving yet another step for me to do.
    My current script is set to append to the same results file and will echo [name of file I am searching]:  No errors found.  Otherwise, the
    output shows the filename and the string text that matched.  Because the results append to it, I can only run the script against each file separately or create individual output names.  I would rather not do that if I could include it all in one.
     This would also free me from babysitting it and running each file script separately upon the other's completion.  I can continue with my job and come back later and view the completed report all in one.  So
    if I could perform this on an entire folder, then I would want the entries to include the filename, the line number that the match occurred on in that file and the string text that was matched (each occurrence).  I don't want the entire line to be listed
    where the error was, just the match itself.
    Example:  (In the event this doesn't display correctly below, each match, it's corresponding filename and line number all go together on the same line.  It somehow posted the example jumbled when I listed it) 
    File1.txt Line 54 
    Job terminated unexpectedly
     File1.txt Line 58 Process not completed
    File1.txt
    Line 101 User input not provided
    File1.txt
    Line 105  Process not completed
    File2.txt
    No errors found
    File3.txt
    Line 35 No tape media found
    File3.txt
    Line 156 Bad surface media
    File3.txt Line 188
    Process terminated
    Those are just random fake examples for this post.
    This allows me to perform analysis on a set of files for various projects I am doing.  Later on, when the entire search is completed, I can go back to the results file and look and see what files had items I wish to follow up on.  Therefore, the
    line number that each match was found on will allow me to see the big picture of what was going on when the entry was logged.
    I actually import the results file into a spreadsheet, where further information is stored regarding each individual text string I am using.  Very useful.
    If you know how I can successfully achieve this in one script, please share.  I have seen plenty of posts out there where people have requested all different aspects of it, but I have yet to see it all put together in one and work successfully.
    Thanks for helping.

    I'm sorry.  I was so consumed in locating the issue that I completely overlooked posting what exactly I was needing  help with.   I did have one created, but I came across one that seemed more organized than what I originally created.  Later
    on I would learn that I had an error in log location on my original script and therefore thought it wasn't working properly.  Now that I am thinking that I am pretty close to achieving what I want with this one, I am just going to stick with it.
    However, I could still use help on it.  I am not sure what I did not set correctly or perhaps overlooking as a typing error that my very last line of this throws an "Expected Statement" error.  If I end with End, then it still gives same
    results.
    So to give credit where I located this:
    http://vbscriptwmi.uw.hu/ch12lev1sec7.html
    I then adjusted it for what I was doing.
    What this does does is it searches thru log files in a directory you specify when prompted.  It looks for words that are contained in another file; objFile2, and outputs the results of all matching words in each of those log files to another file:  errors.log
    Once all files are scanned to the end, the objects are closed and then a message is echoed letting you know (whether there errors found or not), so you know the script has been completed.
    What I had hoped to achieve was an output to the errors.log (when matches were found) the file name, the line number that match was located on in that file and what was the actual string text (not the whole line) that matched.  That way, I can go directly
    to each instance for particular events if further analysis is needed later on.
    So I could use help on what statement should I be closing this with.  What event, events or error did I overlook that I keep getting prompted for that.  Any help would be appreciated.
    Option Explicit
    'Prompt user for the log file they want to search
    Dim varLogPath
    varLogPath = InputBox("Enter the complete path of the logs folder.")
    'Create filesystem object
    Dim oFSO
    Set oFSO = WScript.CreateObject("Scripting.FileSystemObject")
    'Creates the output file that will contain errors found during search
    Dim oTSOut
    Set oTSOut = oFSO.CreateTextFile("c:\Scripts\errors.log")
    'Loop through each file in the folder
    Dim oFile, varFoundNone
    VarFoundNone = True
    For Each oFile In oFSO.GetFolder(varLogPath).Files
        'Verifies files scanned are log files
        If LCase(Right(oFile.Name,3)) = "log" Then
            'Open the log file
            Dim oTS
            oTS = oFSO.OpenTextFile(oFile.Path)
            'Sets the file log that contains error list to look for
            Dim oFile2
            Set oFile2 = oFSO.OpenTextFile("c:\Scripts\livescan\lserrors.txt", ForReading)
            'Begin reading each line of the textstream
            Dim varLine
            Do Until oTS.AtEndOfStream
                varLine = oTS.ReadLine
                Set objRegEx = CreateObject("VBScript.RegExp")
                objRegEx.Global = True  
                Dim colMatches, strName, strText
                Do Until oErrors.AtEndOfStream
                    strName = oFile2.ReadLine
                    objRegEx.Pattern = ".{0,}" & strName & ".{0,}\n"
                    Set colMatches = objRegEx.Execute(varLine)  
                    If colMatches.Count > 0 Then
                        For Each strMatch in colMatches 
                            strText = strText & strMatch.Value
                            WScript.Echo "Errors found."
                            oTSOut.WriteLine oFile.Name, varLine.Line, varLine
                            VarFoundNone = False
                        Next
                    End If
                Loop
                oTS.Close
                oFile2.Close
                oTSOut.Close
                Exit Do
                If VarFoundNone = True Then
                    WScript.Echo "No errors found."
                Else
                    WScript.Echo "Errors found.  Check logfile for more info."
                End If
        End if

  • Newbie: How to manage the number of files in a folder

    I have a backup application that runs each day and creates a file in a folder.
    I have an iCal scipt which automates this backup to run at a specific time but I would like to modify it so that it deletes the oldest file in the folder. I cannot figure out the best way to do this. Does anyone have any suggestions?

    This rather long script finds the oldest file in the complete nested range of a chosen outer folder and deletes it.
    property filePathList : {}
    property fileDateList : {}
    getEveryFileName((choose folder) as alias)
    Sort_items(fileDateList, filePathList)
    set oldest to item 1 of filePathList
    tell application "Finder" to delete oldest
    to getEveryFileName(theFolder)
    tell application "Finder"
    my getNamesDates(get files of theFolder)
    set FolderList to folders of theFolder
    repeat with everyFolder in FolderList
    my getEveryFileName(everyFolder)
    end repeat
    end tell
    end getEveryFileName
    to getNamesDates(FileList)
    repeat with everyFile in FileList
    try
    tell application "Finder"
    set end of fileDateList to modification date of everyFile
    set end of filePathList to everyFile as alias
    end tell
    on error anError
    display dialog anError
    end try
    end repeat
    end getNamesDates
    to Sort_items(sortList, SecondList)
    -- sorts by the first list (dates), while keeping the second list in the same order.
    tell (count sortList) to repeat with i from (it - 1) to 1 by -1
    set s to sortList's item i
    set r to SecondList's item i
    repeat with i from (i + 1) to it
    tell sortList's item i to if s > it then
    set sortList's item (i - 1) to it
    set SecondList's item (i - 1) to SecondList's item i
    else
    set sortList's item (i - 1) to s
    set SecondList's item (i - 1) to r
    exit repeat
    end if
    end repeat
    if it is i and s > sortList's end then
    set sortList's item it to s
    set SecondList's item it to r
    end if
    end repeat
    end Sort_items
    dual-core G5/2.3   Mac OS X (10.4.6)   dual screens

  • Maximum number of files in a folder ?

    Hello, what is the maximum number of files in a folder OS X can handle ?
    I used a file recovery software called FileSalvage to save some files of an external 300GB with a corrupted disk directory (unable to repair with the usual repair/recovery programs).
    FileSalvage recovered about 435,000 files and sorted them by extension in individual folders, unfortunately it does not recognize the file names and just sequentially names the files per extension.
    The .jpeg, .gif and .html folders had up to 75,000 files. After recovery the external FW drives started to behave very strange, unresponsive, just hanging, time-out. I tried on a Mac Mini, iMac G5, an iBook and PowerBook, OS X 10.3.9 and 10.4.3, FW400/800 and USB 2.0 interface, they all had pretty much the same failure mode after a while.
    Running Disk Utility on the drives with the recovered FileSalvage folders showed a corrupted directory (invalid file count) and unable to repair, although I could copy most of the folders of the disk (deleted the folders with more than 10,000 files per folder).
    I suspect that File Salvage copies more files in a folder than OS X allows, causing unpredicable problems.
    Any ideas ?

    From "Mac OS X: Mac OS Extended Format volume and file limits"
    "Maximum number of files (or files and folders) in a folder … up to 2.1 billion"
    According to a note in the document, the above is subject to the drive's size (maximum 16 terabytes in "Tiger") and block size, ie. the number of available blocks.
    So it would appear that the number of files you mentioned would be well within theoretical limits, although I suppose there could be a bug in some other part of OS X. Otherwise, maybe there is a problem with the drive...

  • Counting files in a Flder

    Hi all,
    I have to count the number of files in a folder and their
    respectives name in it using flash.Is it possible to do it by JSFL.
    can anyone give me samples regarding this.thanks in advance.
    Regards,
    S.Hidayath

    If you are using JSFL (authoring environment),,,,
    var folder = fl.browseForFolderURL('SELECT FOLDER');
    if (folder!=null) {
    var list = FLfile.listFolder(folder, 'files');
    fl.outputPanel.trace("There are "+list.length+" files in the
    specified folder");
    fl.outputPanel.trace("The names of these files are: "+list);
    If you only wanted it to find .fla's for example, you would
    use:
    var list = FLfile.listFolder(folder+'/*.fla', 'files');
    I haven't tested this as I am not on a computer with
    Flash.

  • Script doesn't take all the files in the folder

    I have compiled a script from different resources. It pads images to specified dimensions.  But I can't get it to process all the images in a folder. It only does one.
    Here is the script.
    (* IMPORTANT: The with pad color parameter of the pad command does not work in Mac OS 10.5.5. Use4 the SIPS command-line utility instead when padding with a color *)
    set this_folder to (choose folder with prompt "Pick the folder containing the files to process:") as string
    tell application "System Events"
      set these_files to every file of folder this_folder
    end tell
    repeat with i from 1 to the count of these_files
      set this_file to (item i of these_files as alias)
      set this_info to info for this_file
    end repeat
    property target_dimensions : "1024, 768"
    property default_color : {0, 0, 0}
    set this_path to the quoted form of the POSIX path of this_file
    -- get the final dimensions for the padded image
    repeat
    display dialog "Enter the target dimensions for the padded image:" & return & return & "target width, target height" default answer target_dimensions buttons {"Cancel", "Set Color", "Continue"} default button 3
      copy the result to {text returned:dimensions_string, button returned:button_pressed}
      if the button_pressed is "Set Color" then
      set the default_color to choose color default color default_color
      else
      try
      if the dimensions_string does not contain "," then error
      set AppleScript's text item delimiters to ","
      copy every text item of the dimensions_string to {width_string, height_string}
      set AppleScript's text item delimiters to ""
      set target_W to width_string as integer
      set target_H to height_string as integer
      if target_W is less than 1 then error
      if target_H is less than 1 then error
      set the target_dimensions to (target_W & ", " & target_H) as string
      exit repeat
      on error
      beep
      end try
      end if
    end repeat
    set the hex_color to text 2 thru -1 of (my RBG_to_HTML(default_color))
    try
      tell application "Image Events"
      -- start the Image Events application
      launch
      -- open the image file
      set this_image to open this_file
      -- get dimensions of the image
      copy dimensions of this_image to {W, H}
      -- calculate scaling
      if target_W is greater than target_H then
      if W is greater than H then
      set the scale_length to (W * target_H) / H
      set the scale_length to round scale_length rounding as taught in school
      else
      set the scale_length to target_H
      end if
      else if target_H is greater than target_W then
      if H is greater than W then
      set the scale_length to (H * target_W) / W
      set the scale_length to round scale_length rounding as taught in school
      else
      set the scale_length to target_W
      end if
      else -- square pad area
      set the scale_length to target_H
      end if
      -- perform action
      scale this_image to size scale_length
      (* The with pad color parameter is broken in Mac OS X 10.5.5
      -- perform action
      pad this_image to dimensions {target_W, target_H} with pad color default_color
      -- save the changes
      save this_image with icon
      -- purge the open image data
      close this_image
      end tell
    -- The with pad color parameter is not working in 10.5.5 so use the SIPS command-line utitlity instead
    do shell script "sips " & this_path & " -p " & target_H & space & target_W & space & "--padColor " & hex_color & space & "-i"
    on error error_message
    display dialog error_message buttons {"Cancel"} default button 1
    end try
    on RBG_to_HTML(RGB_values)
    -- NOTE: this sub-routine expects the RBG values to be from 0 to 65535
      set the hex_list to {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"}
      set the the hex_value to ""
      repeat with i from 1 to the count of the RGB_values
      set this_value to (item i of the RGB_values) div 256
      if this_value is 256 then set this_value to 255
      set x to item ((this_value div 16) + 1) of the hex_list
      set y to item (((this_value / 16 mod 1) * 16) + 1) of the hex_list
      set the hex_value to (the hex_value & x & y) as string
      end repeat
      return ("#" & the hex_value) as string
    end RBG_to_HTML

    The problem is this repeat loop
    repeat with i from 1 to the count of these_files 
      set this_file to (item i of these_files as alias) 
      set this_info to info for this_file 
    end repeat 
    It goes through every file in the folder but only sets the variable this_file to one file. When the loop is finished this_file is only pointing to one file, which is the file that will be processed.
    A few ways to handle this, the easiest is to move the
    end repeat
    at line 5 to the just after the do shell script at line 81.

  • Copy, count files, test path, process indicator and System.IO.FileInfo

    I found this, sctipt, that I try to re-write.
    As it is, it creates sub folders in the targetfolder, which I found out how to stop it from, by deleting the "\" backslash sign in line 9.
    But what I also want is that subfolders if such should exist, also gets copied from $source to $target folder, as of now this doesn't happen. Reason why I chose to try to re-write the script is basically, I can read what it does and I like all the flashy
    Things like counting and that it shows the percentage of the processbar AND the processbar :).
    I just don't now how to re-write it proberly. By the way nothing should be re-named in the targetfolder every thing from sourcefolder should be "as is" in the sourcefolder.
    $SourceFolder = "C:\Color1\TRID"
    $targetFolder = “C:\Color2\TRID”
    $numFiles = (Get-ChildItem -Path $SourceFolder -Filter *.*).Count
    $i=0
    clear-host;
    Write-Host ‘This script will copy ‘ $numFiles ‘ files from ‘ $SourceFolder ‘ to ‘ $targetFolder
    Read-host -prompt ‘Press enter to start copying the files’
    Get-ChildItem -Path $SourceFolder -Filter *.* | %{
    [System.IO.FileInfo]$destination = (Join-Path -Path $targetFolder -ChildPath $_.Name.replace(“_”,“\”))
    if(!(Test-Path -Path $destination.Directory ))
    New-item -Path $destination.Directory.FullName -ItemType Directory
    [int]$percent = $i / $numFiles * 100
    copy-item -Path $_.FullName -Destination $Destination.FullName
    write-Progress -Activity “Copying … ($percent %)” -status $_ -PercentComplete $percent -verbose
    $i++
    Write-Host ‘Total number of files read from directory ‘$SourceFolder ‘ is ‘ $numFiles
    Write-Host ‘Total number of files that was copied to ‘$targetFolder ‘ is ‘ $i
    Read-host -prompt “Press enter to complete…”
    clear-host;

    @Jaap
    Yes I want to overwrite existing files, since backup is taken care of by another script.
    Now I encounter this error when trying to use your write-progress example:
    Get-ChildItem : A parameter cannot be found that matches parameter name 'Files'.
    At line:3 char:51
    + $Files = Get-ChildItem -LiteralPath $SourceFolder -Files
    +                                                  
    ~~~~~~
        + CategoryInfo          : InvalidArgument: (:) [Get-ChildItem], ParameterBindingException
        + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
    cmdlet ForEach-Object at command pipeline position 1
    Supply values for the following parameters:
    Process[0]:
    Here is the script as I thought it should look like:
    $SourceFolder = "C:\Color1\TRID"
    $targetFolder = “C:\Color2”
    $Files = Get-ChildItem -LiteralPath $SourceFolder -Files
    $NumberofFiles = $Files.Count
    $Files | ForEach-Object -Begin {
    $FilesCopied = 0
    -progress{
    Write-Progress -Activity "Copying Files..." -PercentComplete [int](($FilesCopied/$NumberofFiles)*100) -CurrentOperation "$FilesCopied files copied out of total of $NumberofFiles files" -Status "Please wait."
    "$((Get-ChildItem -Recurse -File -LiteralPath $SourceFolder).Count) files will be copied to $targetfolder"
    Read-Host -Prompt 'Press Enter to Start Copying...'
    Copy-Item $SourceFolder -Recurse -Destination $targetFolder -Force -verbose
    $FilesCopied++
    # What is wrong now?

  • Lightroom not finding DNG files in the folder

    I am using Lightroom 2.5.  My library includes a folder with approximately 5000 images which is located on an external hard drive as is my Lightroom catalog.  I use the external dive because it is part of a RAID 1 array to backup my images. 
    My problem began when I used Lightroom to convert the 600 RAW files in the folder to DNG files.  Prior to the conversion, the library tab showed that there were 5000 files in the folder.  After the conversion, the library tab shows that there are only 4400 files.  The DNG files are actually there but Lightroom will not recognize them.  I can use windows explorer to see them and that there are 5000 files in the directory. 
    I have tried to synchronize the folder, but it did not help.  I have also tried to write metadata to the files to make sure that was not the problem and it was no help.  As a test, I also copied the directory to my local hard drive and imported that into Lightroom.  That folder has the correct 5000 images, but of course non of the ratings that I had applied to the 5000 files to organize them so the local folder is useless.
    Can anyone suggest a means of convincing Lightroom that it should recognize the missing DNG files that are actually there?
    Thank you.

    John,
    Thank you for your suggestions.  I do have filters off. 
    I started up Lightroom today and again, the Folders tab only showed that the folder had 600 files which corresponds to the missing 600 DNG files.  Furthermore, in the grid view, only the 600 DNG files were appearing.  But, after a minute and without my input, Lightroom loaded up the 4400 JPEG images into the grid and the DNG files disappeared both from the file count and the grid view.
    When I look at the All Photographs folder in grid view, I can find the missing DNG files so they are in the All Photographs folder. 
    I did as you suggested and I optimized the catalogue.  Now when I launch Lightroom, I see the missing 600 DNG files in the grid view and the file count for the folder.  But that only lasts a few seconds before the 4400 JPEGS appear and the DNG files disappear.  So the optimization made the loading faster as it should, but did not help Lightroom to find the DNG files.
    Now when I try to synchronize the folder, It does show that there are 600 files to be added.  However, synchronization does not help and DNG files are still missing.
    I can see the DNG files in a folder called “Already in Catalog” from when I tried to synchronize the original folder.  After optimizing the catalog, I told Lightroom to write metadata for the DNG files.  Once I did that, some of the missing DNG files did appear in the grid view of the original folder (but not all of the 600 missing files).  However, the library still only shows 4400 files in the folder. 
    One last oddity. When I change the sort to “user order” from “capture time”, I see only the 600 missing DNG files in the grid view.  The 4400 JPEG files are gone.  But when I change the sort back to capture time, the JPEG files and the few DNG files are there again and most of the DNG files are gone.
    This bugginess is only occurring on the external drive.  The same files saved to the local hard drive all appear in the file count and the grid view.
    Thank you.

  • Archiving  file in different folder in sender file adapter

    Hi,
    I have a requirement in witch i have to pick 7 different file from seven different folder.
    for this I am using advance selection tab and defining all the other folder path.
    but my problem is I have to archive the different file in different folder .
    For exm..
    /folder1/file1.txt need to be archive in /archive_filder1/file1.txt
    /folder2/file2.txt need to be archive in /archive_filder2/file2.txt
    /folder3/file3.txt need to be archive in /archive_filder3/file3.txt
    can any one tell me that how to  define the dynamic  archive folder path??.
    regards,
    Navneet

    Hi Navneet
    In File Access parameters --> Target Directory
    Use this type of Directory name
    \XIDEV_STORES\%store%\sapoutbound
    here %store% will be changed accordingly
    e.g. if file will come for store 001 then this %Store% will be replaced by 001 and file will be placed in this 001 folder and if file will come for store 002 then this %Store% will be replaced by 002 and file will be placed in this 002 folder over FTP.
    For to achieve this Go to Advanced tab 
    For Variable Substitution check mark Enable
    Now speciofy the parameter values for Variable Name and Reference
    Under Vriable name specify = store
    Under Reference specify = payload:WP_PLU02,1,IDOC,1,EDI_DC40,1,RCVPRN,1     -
    You have to give full path name here that where this store variable is located into IDOC.
    Hope this example will help you
    Regards
    Dheeraj Kumar

Maybe you are looking for