Place a file in a random directory?

Hello guys!  What i'm trying to do is to make an applescript that places a file in a random directory, anywhere on the computer. It would then make an alias for it in a set file, but I can handle that part. Can anyone explain how one would go about placing it randomly? Thanks for any advice you can give.

Use code such as:
tell application "Finder"
with timeout of 120 seconds
move (choose file) to some folder of entire contents of folder "Macintosh HD"
end timeout
end tell
You may need to increase the timeout or run into a permissions error when using the script.
(107900)

Similar Messages

  • I create a document in pages and then export it as doc or docx file. I then email or place the file in a drop box. When another computer opens the doc or docx the photos in the document are randomly scattered. What is the solution?

    I create a document in pages with photos. I then save it and I also export it as a doc or docx file. I then email or place in a drop box the doc or docx file. The other computer opens the file in Microsoft word and the text remains in place but the photos are randomly scattered throughout the document. What is going wrong? How do I correct this problem? I really don't want to go back to a Microsoft machine.

    That assumes two things:
    1. That Apple would have let Microsoft have access to its file format.
    2. That Microsoft would want to spend the time and trouble to write filters for file formats that Apple can't be bothered doing for its own software.
    Peter

  • Organizer defect creates and leaves temporary files in the open directory.

    I'm using Photoshop Elements 11 Organizer and Adobe Bridge CS6 concurrently.  If I have Bridge open to the same folder as PSE Organizer and I do an "Add captions ..." operation to a group of files selected in the Organizer, then there is a very good chance that PSE Organizer will rename one or more files to OriginalFileName_edTMP-1.extension and leave the renamed file in the directory rather than completing the update and returning the file(s) to their original name.  In most cases my original files are Nikon .nef files with .xmp sidecar files, but I've also seen this happen with .psd files.  The .nef files are generally large, averaging 35 Mb per .nef image and the .psd files are usually over 100 Mb.  If PSE Organizer and Bridge are open to different folders then Organizer does not leave the renamed file.  Thus I would suggest that there may be a logical threading error in PSE Organizer where it does not consider that another application may be monitoring the folder and also opening the files, which is what Bridge does when it discovers that a file has changed (the addition of a caption changes the file contents.)  This was also a defect in PSE Organizer 10.

    I believe you missed the point.  And just for the record I have 40+ years of software engineering experience and do know something about data bases and application programming.  There is a defect in the Photoshop Elements Organizer and I suspect that one of the developers forgot to check a return code from an operation.  I also suspect that what happens is that the Organizer temporarily renames the file it wants to update, makes the update, and then intends or tries to rename it back to the original name.   But with Bridge running in the background and watching to see if there are any changes in the folder, Bridge sees the new file name and makes the file (or possibly the directory) temporarily unavailable to the Organizer as Bridge updates its information and the window display.  If the timing of the operations is just right, the Organizer can't access what it needs to and probably gets a failed return code from the rename operation.  If my supposition is correct, the code doesn't check this return code after the rename operation and just assumes that it took place.  The problem is clearly related to timing (race condition) and is more likely to occur on large files, such as 100+ MB Photoshop files.  Just for the record, I am not actually working with both Organizer and Bridge at the same time.  Bridge is running in the background.  I've learned to avoid the problem by pointing Bridge to a different folder when I do an update in Organizer.  I also realize that information that I might add in Bridge does not show up in the Organizer Catalog, but fortunately Bridge is smart enough to extract tags and titles that I've added with the Organizer once Organizer has written them to the files. The problem that I'm reporting is not an issue about what a user should or can do, it's about safe programming practices.  Adobe will decide if they want to fix it or not.

  • Writing the file to a specific directory on server using DATASET

    Hello Friends
    I know that using dataset command we can create a file, write to a file, read from a file etc.,
    But by default it uses the directory DIR_SAPUSERS which is the ./ directory.
    But this particular directory DIR_SAPUSERS also has other system related log files etc.,
    Is there a way to make the command DATASET write to a user created directory instead of this ./ ??
    Any suggestions or comments will be highly appreciated.
    Thanks
    Ram

    IF NOT p_ufile IS INITIAL.
    OPEN DATASET p_ufile FOR INPUT IN TEXT MODE.
    IF sy-subrc <> 0.
    EXIT.
    ENDIF.
    here p_ufile will contain the path where ever u need to place the file i.e. use specific path.... ex: "usr/sap/bin/interface"

  • Publish a file to a different directory.

    I've seen other questions similar to mine on the forums but haven't found an answer.  My site has a newsletter archive that links to all of our past newslettters.  The newsletters are just html files saved from emails we send out.
    To keep things organized, the newsletters are grouped by year, so all 2010 newsletters are saved in the 2010 directory.  However, when I add the newsletter using the Link to File on My Computer, it adds the newsletter html file to the current directory.
    Is there any way, without using an outside FTP program, to upload the newsletter to the 2010 directory and then link to it from the main newsletter archive page?  I can't use the administer->file placement option because the rule  only applies to this specific upload. This seems like it should be an obvious, simple thing, but I'm stumped.

    Hi,
         As of now I do not think this is possible in Contribute. But there can be a work-around.Can you try the following steps:
    When you edit a web page, add the links to the files in your computer.
    Do Publish As New Page (File -> Actions -> Publish As New Page), and select the Folder in which you want to publish your pages to, by clicking the Choose Folder button.
    The web page and all the files from your computer will be published to that folder.
    Now, re-edit the published web page with the links, and Publish As New Page to the original folder in which the web page was present.
    This is a long workaround, where you will be publishing the web page twice. Hope this helps.

  • How can i use the same communication channel to place the file in 2 differe

    Hello Guys,
    We have a requirement where I need to archive the file that i am sending to the legacy FTP server in a Idoc to file scenario.
    How can i place the file in 2 different locations. In this case place the file in the FTP server and a copy of it in the local NFS folder.

    >
    Rajeev kumar wrote:
    > Hello,
    > As per the standards we are supposed to use only one channel.
    > that is one idoc, one message in the sxmb_moni.
    Rajeev,
    You can use an ftp job and save it on XI's folder.
    Process the file into tmp directory on local file system and run operating system command to run ftp job to send the file to your file server and then copy the file to your archive folder and then delete the file from tmp.
    This should solve your problem.
    Regards,
    AV.

  • List files stored in a Directory Object

    Hi,
    I looked on Google, on Oracle DB docs and here to find a convenient way to list files stored in a DIRECTORY for batch loading in a table with PL/SQL. But no luck, UTL_FILE doesn't seem to have a method for directory listing. I saw examples with some workaround like putting files list in a text file prior to loading. The directory is feeded by other process and network services, so I don't know the filelist that I need to import and, then delete. I dont have access to the server console and it's impossible for me to dump a kind of «dir» result into a text file. I saw other examples using Java, but it looks like I don't have access to Server Side Java too.
    Is there a simple way to do that in PL/SQL only?
    If not, I'll ask to the DBA the necessary rights to compile/run java on the server side...
    The DB target versions for this requirement are 10g and 11g (mainly) on Windows environment.
    Thanks
    Bruno

    brlav35 wrote:
    The XUTL_FINDFILES seems to be the more convenient way. If that works for you, I certainly have no objection. In a lot of environments, though, that package would be problematic.
    1) It must be installed in the SYS schema. That's generally frowned upon and lots of sites would never allow user code to go into the SYS schema. Chris is a bright guy, so I'm sure the risk of it causing harm is minimal (most likely during an install or upgrade), and it will almost certainly never cause you harm, but that would be a political show-stopper at a lot of places.
    2) The package body is wrapped (if there is a version with the package body in clear text, this point is moot). Again, Chris is a well-respected guy, so I have every confidence that the code is not malicious, but asking a DBA to install a wrapped package you downloaded from the internet into the SYS schema on a production database should generate a crud-load of red flags. This is almost certainly just a theoretical danger, but DBAs and audit compliance regulations care a great deal about theoretical dangers. If someone hacked the web site and uploaded their own wrapped bit of code that had a back door, for example, it would be very hard to catch.
    3) Under the covers, the package is querying one of the undocumented X$ views. Oracle is free to change those views over time, which would potentially cause the package to stop working or stop working correctly in some way. If you're developing code for a system that may be around for a number of years, that becomes a concern. It's unlikely that Oracle will change the particular X$ view that is being referenced here over the lifetime of your code base, but it's more than a trivial concern.
    4) The package is determining what directories a user has access to, that's not Oracle enforcing the restriction. Probably not too big a deal, but it is probably safer from a regulatory compliance standpoint to be able to rely on Oracle the database enforcing privileges rather than relying on a delivered package to enforce those privileges. It's the difference between telling Oracle via specific grants which directories the JVM can access vs. writing your own wrapper that enforces those restrictions. In the end, the restrictions are enforced, but in one case you're relying on the developers of the Oracle database and in the other you're relying on external developers.
    Just to re-iterate-- Chris is a brilliant guy, I don't mean this in any way to impugn him or his code. I am totally confident that his code works, that it works well, and that it will continue to work going forward. My concerns are purely on the political/ regulatory side of things, not on the technical side of things. Technically, I am confident that the code is top-notch.
    Justin
    Edited by: Justin Cave on Sep 9, 2009 12:38 PM
    I wrote this before seeing the last few bits of the exchange where you and Chris already talked about the first point.

  • Count files in Directory and the number of files in each sub directory

    Hello,
    I trying write a method which will start at a root of a file and count all the files in that directory. Then count all the files in each sub directory.
    import java.io.File;
    import java.io.FilenameFilter;
    import java.io.IOException;
    public class RunScan {
         * @param args
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              File file = new File("/home/robert/count");
              File[] files = file.listFiles();
              traverse(files);
              printfiles();
         private static int totalNumFiles = 0;
         private static int totalNumDir = 0;
         private static int filePerDir = 0;
         private static int subDir = 0;
         private static void traverse(File[] files) {
    for(int i = 0; i < files.length; i++) {
    if(files.isDirectory()) {
         totalNumDir++;
         printDir(files[i].toString());
         traverse(files[i].listFiles());
    totalNumFiles++;
    filePerDir++;
         private static void printfiles(){
              System.out.println("total files "+ (totalNumFiles));
         System.out.println("totls sub dir "+ totalNumDir);
         private static void printDir(String dirName){
              System.out.println("Total Files in "+dirName+" "+filePerDir);
              filePerDir = 0;

    Hint: Google "visitor pattern." This gives clues how to build a re-usable solution that can you use for future traversals that do things other than just file counts. Here's a teaser of an simple interface:
    public interface TreeVisitor {
    * Processes a single file or directory. <em>Tip:</em> If you want to track the number of
    * items processed, this function is the best place to update a counter.
    * Implementors of this method should not throw checked exceptions.
    * @param item The file or directory process.
    * @param depth Number of levels below top of traversal tree (0 = top of tree).
    public void visit(File item, int depth);
    }

  • How to Automate Compressing PDF files in a Watched Directory

    I want to automatically compress PDF files as they get placed into a watched directory. I would like the compressed files placed in another directory and have the original file either deleted or place in another directory. If Acrobat Pro X can do this, how do I set it up.

    I noticed that Acrobat Distiller will watch an input directory and move files to an output directory. I tried using Distiller to compress a PDF file, but all it did was move the PDF file to the out directory without doing any compression. Is there any way that Distiller could be configured to do what I want?
    I also called the number listed on the Adobe web site for LiveCycle products. They told me they don't sell their product to non government companies and they referred me to 4 Point to get further info. I called them and only got a voice mail. I'm waiting for a call back.
    I found a product that does exactly what I need. It is called PdfCompressor Professional Edition. But, it costs more than what I want to spend. I'm guessing that LiveCycle will cost more than I want to spend also. If there are any other products that cost less than $150, I would like to know what they are.

  • Files missing from install directory

    not sure what's happened to my computer but I can no longer install programs or updates for programs as I get the message "files missing from install directory"
    How did they get corrupt in the first place? I get this when trying to download yahoo messenger of all programs...duh!  I'm getting pretty frustrated since this has only started a month ago and I've been hoping something would fix itself but no....the last time my Toshiba service station updated was Jan 24 and now it says unable to connect with server....yet I got here to post a message and can get to the internet so don't understand why the updates can get in?
    any advice?

    that can be a problem with your windows.. your OS..
    rebuilding your OS should be able to fix it.
    oOo
    *Read EULA before installing any software.

  • Mysterious Random Directory

    First of all, thank you to anyone that helps me out with this.
    I am installing an application on all the computers in my office.  Once installed, I need to copy a configuration file from a server to a specific folder on each computer.  Here's the tricky part... the folder lies in a random directory that will
    be different on each computer.
    E.g. C:\Users\user\AppData\Roaming\BigComp_Technologies\BigComp.exe_Url_q33dlojbvd3slc13unpuhkzm2vxeawqp\2.0.0.0
    How can I copy the config file to the 2.0.0.0 folder?  
    I would prefer Powershell or command line script as I have no experience with VB.  
    Thanks again for your help, David

    Sure, here's some comments in the code along with some syntax links:
    # This gets a list of directories under the path specified.
    # Only directories are returned, due to the -Directory switch (this requires at least v3 of PowerShell).
    # The where command is used to only include directories that start with BigComp.
    $folder = Get-ChildItem C:\Users\user\AppData\Roaming\BigComp_Technologies -Directory |
    Where { $_.Name -like 'BigComp*' }
    # This copies the file in the -Path parameter to the destination.
    # Join-Path is used to stick the folder found above (saved in the $folder variable) together with the known subfolder of 2.0.0.0
    Copy-Item -Path C:\Temp\config.txt -Destination (Join-Path -Path $folder -ChildPath '2.0.0.0')
    http://ss64.com/ps/get-childitem.html
    http://ss64.com/ps/where-object.html
    http://ss64.com/ps/copy-item.html
    http://ss64.com/ps/join-path.html
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

  • Where did this Make file in my home directory come from?

    I found a make file in my home directory. Here are it's contents.
    fig4latex makefile
    all:
    Pacman did update latex over the weekend. Any idea where this file came from?
    It's causing my OCD to flare up
    I looked at file time stamp and then went to that time in Systemd logs Found this.
    Mar 16 19:38:19 tesla slim[799]: If you are changing from PdfLaTeX (-p) to LaTeX (-l), or vice versa,
    Mar 16 19:38:19 tesla slim[799]: Now run 'make' to update your graphics files.
    More of the surrounding log below.
    Mar 16 19:38:57 tesla slim[799]: dactyl: bootstrap: startup startup
    Mar 16 19:38:57 tesla slim[799]: (process:10558): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
    Mar 16 19:38:56 tesla slim[799]: Conky: APCUPSD getaddrinfo: Name or service not known
    Mar 16 19:38:49 tesla sudo[9911]: pam_unix(sudo:session): session closed for user root
    Mar 16 19:38:49 tesla sudo[9911]: pam_unix(sudo:session): session opened for user root by (uid=0)
    Mar 16 19:38:49 tesla sudo[9911]: patrick : TTY=pts/7 ; PWD=/home/patrick/scratch/rails_projects/inrealmoney ; USER=root ; COMM
    Mar 16 19:38:46 tesla slim[799]: Conky: APCUPSD getaddrinfo: Name or service not known
    Mar 16 19:38:36 tesla slim[799]: Conky: APCUPSD getaddrinfo: Name or service not known
    Mar 16 19:38:26 tesla slim[799]: Conky: APCUPSD getaddrinfo: Name or service not known
    Mar 16 19:38:19 tesla slim[799]: run 'make clean' then 'make'.
    Mar 16 19:38:19 tesla slim[799]: If you are changing from PdfLaTeX (-p) to LaTeX (-l), or vice versa,
    Mar 16 19:38:19 tesla slim[799]: Now run 'make' to update your graphics files.
    Mar 16 19:38:16 tesla slim[799]: pentadactyl: bootsttrap: shutdown shutdown
    Mar 16 19:38:16 tesla slim[799]: pentadactyl: All dactyl modules destroyed
    Mar 16 19:38:16 tesla slim[799]: Conky: APCUPSD getaddrinfo: Name or service not known
    Mar 16 19:38:06 tesla slim[799]: Conky: APCUPSD getaddrinfo: Name or service not known
    Mar 16 19:37:56 tesla slim[799]: Conky: APCUPSD getaddrinfo: Name or service not known
    Mar 16 19:37:46 tesla slim[799]: Conky: APCUPSD getaddrinfo: Name or service not known
    Mar 16 19:37:36 tesla slim[799]: Conky: APCUPSD getaddrinfo: Name or service not known
    Mar 16 19:37:26 tesla slim[799]: Conky: APCUPSD getaddrinfo: Name or service not known
    Mar 16 19:37:16 tesla slim[799]: Conky: APCUPSD getaddrinfo: Name or service not known
    Mar 16 19:37:06 tesla slim[799]: Conky: APCUPSD getaddrinfo: Name or service not known
    Mar 16 19:37:02 tesla slim[799]: Conky: APCUPSD getaddrinfo: Name or service not known
    Mar 16 19:37:01 tesla slim[799]: Mono: Playback 127 [100%] [0.00dB] [on]
    Mar 16 19:37:01 tesla slim[799]: Limits: Playback 0 - 127
    Mar 16 19:37:01 tesla slim[799]: Playback channels: Mono
    Mar 16 19:37:01 tesla slim[799]: Capabilities: pvolume pvolume-joined pswitch pswitch-joined
    Mar 16 19:37:01 tesla slim[799]: Simple mixer control 'Master',0
    Mar 16 19:37:01 tesla slim[799]: Mono: Playback 127 [100%] [0.00dB] [on]
    Mar 16 19:37:01 tesla slim[799]: Limits: Playback 0 - 127
    Mar 16 19:37:01 tesla slim[799]: Playback channels: Mono
    If you need anything else please let me know.
    Verbose output
    Verbose output
    Sun 2014-03-16 19:38:19.925442 GMT [s=73377e6d5f2a458c8c92c6c36161ff9f;i=111240;b=c09660a5d55c4510a6a0c5cf2e68a42c;m=8f30c5054;
    PRIORITY=6
    _UID=0
    _GID=0
    _BOOT_ID=c09660a5d55c4510a6a0c5cf2e68a42c
    _MACHINE_ID=9b7a30f5c46c4db38065a4c9fac7320a
    _HOSTNAME=tesla
    SYSLOG_FACILITY=3
    _CAP_EFFECTIVE=1fffffffff
    _TRANSPORT=stdout
    SYSLOG_IDENTIFIER=slim
    _PID=799
    _COMM=slim
    _EXE=/usr/bin/slim
    _CMDLINE=/usr/bin/slim -nodaemon
    _SYSTEMD_OWNER_UID=1000
    _SYSTEMD_SLICE=user-1000.slice
    _SYSTEMD_CGROUP=/user.slice/user-1000.slice/session-1.scope
    _SYSTEMD_SESSION=1
    _SYSTEMD_UNIT=session-1.scope
    _SYSTEMD_USER_UNIT=slim.service
    MESSAGE=Now run 'make' to update your graphics files.
    Sun 2014-03-16 19:38:19.925664 GMT [s=73377e6d5f2a458c8c92c6c36161ff9f;i=111241;b=c09660a5d55c4510a6a0c5cf2e68a42c;m=8f30c5132;
    PRIORITY=6
    _UID=0
    _GID=0
    _BOOT_ID=c09660a5d55c4510a6a0c5cf2e68a42c
    _MACHINE_ID=9b7a30f5c46c4db38065a4c9fac7320a
    _HOSTNAME=tesla
    SYSLOG_FACILITY=3
    _CAP_EFFECTIVE=1fffffffff
    _TRANSPORT=stdout
    SYSLOG_IDENTIFIER=slim
    _PID=799
    _COMM=slim
    _EXE=/usr/bin/slim
    _CMDLINE=/usr/bin/slim -nodaemon
    _SYSTEMD_OWNER_UID=1000
    _SYSTEMD_SLICE=user-1000.slice
    _SYSTEMD_CGROUP=/user.slice/user-1000.slice/session-1.scope
    _SYSTEMD_SESSION=1
    _SYSTEMD_UNIT=session-1.scope
    _SYSTEMD_USER_UNIT=slim.service
    MESSAGE=If you are changing from PdfLaTeX (-p) to LaTeX (-l), or vice versa,
    Last edited by vapidness_is_rampant (2014-03-18 23:15:45)

    fig4latex README wrote:In a large project one would typically place the .fig files in a seperate
    sub-directory.  In "example.tex" the figures are in a sub-directory named
    "figs/" -- changing into that directory and running the fig4latex script
    produces a Makefile, one then runs "make" in order to create the .tex and
    .eps (or .pdf) files which contain the graphic.
    Perhaps you accidentally ran the fig4latex script and it created the Makefile.
    Last edited by o_caino (2014-03-19 00:47:04)

  • How can i get also the files in the root directory and how can i for testing add items of IEnumerable FTPListDetail to List string ?

    What i get is only the directories and files that in other nodes. But i have also files on the root directory and i never
    get them. This is a screenshot of my program after i got the content of my ftp. I'm using treeView to display my ftp content:
    You can see two directories from the root but no files on the root it self. And in my ftp server host i have files in the root direcory.
    This is the method i'm using to get the directory listing:
    public IEnumerable<FTPListDetail> GetDirectoryListing(string rootUri)
    var CurrentRemoteDirectory = rootUri;
    var result = new StringBuilder();
    var request = GetWebRequest(WebRequestMethods.Ftp.ListDirectoryDetails, CurrentRemoteDirectory);
    using (var response = request.GetResponse())
    using (var reader = new StreamReader(response.GetResponseStream()))
    string line = reader.ReadLine();
    while (line != null)
    result.Append(line);
    result.Append("\n");
    line = reader.ReadLine();
    if (string.IsNullOrEmpty(result.ToString()))
    return new List<FTPListDetail>();
    result.Remove(result.ToString().LastIndexOf("\n"), 1);
    var results = result.ToString().Split('\n');
    string regex =
    @"^" + //# Start of line
    @"(?<dir>[\-ld])" + //# File size
    @"(?<permission>[\-rwx]{9})" + //# Whitespace \n
    @"\s+" + //# Whitespace \n
    @"(?<filecode>\d+)" +
    @"\s+" + //# Whitespace \n
    @"(?<owner>\w+)" +
    @"\s+" + //# Whitespace \n
    @"(?<group>\w+)" +
    @"\s+" + //# Whitespace \n
    @"(?<size>\d+)" +
    @"\s+" + //# Whitespace \n
    @"(?<month>\w{3})" + //# Month (3 letters) \n
    @"\s+" + //# Whitespace \n
    @"(?<day>\d{1,2})" + //# Day (1 or 2 digits) \n
    @"\s+" + //# Whitespace \n
    @"(?<timeyear>[\d:]{4,5})" + //# Time or year \n
    @"\s+" + //# Whitespace \n
    @"(?<filename>(.*))" + //# Filename \n
    @"$"; //# End of line
    var myresult = new List<FTPListDetail>();
    foreach (var parsed in results)
    var split = new Regex(regex)
    .Match(parsed);
    var dir = split.Groups["dir"].ToString();
    var permission = split.Groups["permission"].ToString();
    var filecode = split.Groups["filecode"].ToString();
    var owner = split.Groups["owner"].ToString();
    var group = split.Groups["group"].ToString();
    var filename = split.Groups["filename"].ToString();
    var size = split.Groups["size"].Length;
    myresult.Add(new FTPListDetail()
    Dir = dir,
    Filecode = filecode,
    Group = group,
    FullPath = CurrentRemoteDirectory + "/" + filename,
    Name = filename,
    Owner = owner,
    Permission = permission,
    return myresult;
    And then this method to loop over and listing :
    private int total_dirs;
    private int searched_until_now_dirs;
    private int max_percentage;
    private TreeNode directories_real_time;
    private string SummaryText;
    private TreeNode CreateDirectoryNode(string path, string name , int recursive_levl )
    var directoryNode = new TreeNode(name);
    var directoryListing = GetDirectoryListing(path);
    var directories = directoryListing.Where(d => d.IsDirectory);
    var files = directoryListing.Where(d => !d.IsDirectory);
    total_dirs += directories.Count<FTPListDetail>();
    searched_until_now_dirs++;
    int percentage = 0;
    foreach (var dir in directories)
    directoryNode.Nodes.Add(CreateDirectoryNode(dir.FullPath, dir.Name, recursive_levl+1));
    if (recursive_levl == 1)
    TreeNode temp_tn = (TreeNode)directoryNode.Clone();
    this.BeginInvoke(new MethodInvoker( delegate
    UpdateList(temp_tn);
    percentage = (searched_until_now_dirs * 100) / total_dirs;
    if (percentage > max_percentage)
    SummaryText = String.Format("Searched dirs {0} / Total dirs {1}", searched_until_now_dirs, total_dirs);
    max_percentage = percentage;
    backgroundWorker1.ReportProgress(percentage, SummaryText);
    percentage = (searched_until_now_dirs * 100) / total_dirs;
    if (percentage > max_percentage)
    SummaryText = String.Format("Searched dirs {0} / Total dirs {1}", searched_until_now_dirs, total_dirs);
    max_percentage = percentage;
    backgroundWorker1.ReportProgress(percentage, SummaryText);
    foreach (var file in files)
    TreeNode file_tree_node = new TreeNode(file.Name);
    file_tree_node.Tag = "file" ;
    directoryNode.Nodes.Add(file_tree_node);
    numberOfFiles.Add(file.FullPath);
    return directoryNode;
    Then updating the treeView:
    DateTime last_update;
    private void UpdateList(TreeNode tn_rt)
    TimeSpan ts = DateTime.Now - last_update;
    if (ts.TotalMilliseconds > 200)
    last_update = DateTime.Now;
    treeViewMS1.BeginUpdate();
    treeViewMS1.Nodes.Clear();
    treeViewMS1.Nodes.Add(tn_rt);
    ExpandToLevel(treeViewMS1.Nodes, 1);
    treeViewMS1.EndUpdate();
    And inside a backgroundworker do work how i'm using it:
    var root = Convert.ToString(e.Argument);
    var dirNode = CreateDirectoryNode(root, "root", 1);
    e.Result = dirNode;
    And last the FTPListDetail class:
    public class FTPListDetail
    public bool IsDirectory
    get
    return !string.IsNullOrWhiteSpace(Dir) && Dir.ToLower().Equals("d");
    internal string Dir { get; set; }
    public string Permission { get; set; }
    public string Filecode { get; set; }
    public string Owner { get; set; }
    public string Group { get; set; }
    public string Name { get; set; }
    public string FullPath { get; set; }
    Now the main problem is that when i list the files and directories and display them in the treeView it dosen't get/display
    the files in the root directory. Only in the sub nodes.
    I will see the files inside hello and stats but i need also to see the files in the root directory.
    1. How can i get and list/display the files of the root directory ?
    2. For the test i tried to add to a List<string> the items in var files to see if i get the root files at all.
       This is what i tried in the CreateDirectoryNode before it i added:
    private List<string> testfiles = new List<string>();
    Then after var files i did:
    testfiles.Add(files.ToList()
    But this is wrong. I just wanted to see in testfiles what items i'm getting in var files in the end of the process.
    Both var files and directoryListing are IEnumerable<FTPListDetail> type.
    The most important is to make the number 1 i mentioned and then to do number 2.

    Risa no.
    What i mean is this. This is a screenshot of my ftp server at my host(ipage.com).
    Now this is a screenshot of my program and you can see that in my program i have only the directories hello stats test but i don't have the files in the root: htaccess.config swp txt 1.txt 2.png....all this files i don't have it on my treeView.
    What i want it to be is that on my program on the treeView i will also display the files like in my ftp server.
    I see in my program only the directories and the files in the directories but i don't see the files on the root directory/node.
    I need it to be like in my ftp server i need to see in my program the htaccess 1.txt 2.png and so on.
    So what i wrote in my main question is that in the var files i see this files of the root directory i just don't know to add and display them in my treeView(my treeView is treeViewMS1).
    I know i checked in my program in the method CreateDirectoryNode i see in the first iteration of the recursive that var files contain this root files i just dont know how to add and display them in my treeView.
    On the next iterations when it does the recursive it's adding the directories hello stats test and the files in this directories but i need it to first add the root files.

  • Urgent!doubt in upload the file to a particular directory.

    Hi
    Actually i'm developing a site using JSP.
    Main concept of the project is the user should be
    able to access his files or dabases from anywhere
    in the world thru internet via intranet.
    i've placed upload option in my site.
    each user should b given a separate directory.
    can anyone tell me how to make the user to store
    the file in a particular directory(the one alloted to him).
    And to view the file, if the user enters the file name
    it should open the file in the particular format.
    i need the coding since i'm new to jsp.
    can anyone help me or refer any site tht can solve
    my problem?
    thanx in advance.

    I'd just answered a similar case. I believe this is what you are looking for;
    <%@ page contentType="MIME-Type; Charset=Character-Set" %>
    Read up on MIME-Type and Character-Set for info.
    Here some exmaple;
    By default:
    <%@ page contentType="text.html; Charset=ISO-8859-1" %>
    Show an MS Excel file;
    <%@ page contentType="application/vnd.ms-excel" %>
    or
    <%
    String mimeType = "application/vnd.ms-excel"
    response.seContentType(mimeType);
    %>
    Cheers

  • Open files from a specific directory

    Dear all,
    I have the following source code that simply selects files from a directory.
    private void openFile()
    JFileChooser fileChooser = new JFileChooser();
    fileChooser.setFileSelectionMode(
    JFileChooser.FILES_ONLY );
    int result = fileChooser.showOpenDialog( this );
    // user clicked Cancel button on dialog
    if (result == JFileChooser.CANCEL_OPTION )
    return;
    File filename = fileChooser.getSelectedFile();
    if (filename == null || filename.getName().equals( "" ))
    JOptionPane.showMessageDialog( this,
    "Invalid File Name",
    "Invalid File Name", JOptionPane.ERROR_MESSAGE );
    else
    // open the file
    try
         // Open an input stream
         FileInputStream fin1 = new FileInputStream(filename);
    // Read and print a line of text
    BufferedReader d1 = new BufferedReader(new InputStreamReader(fin1));
    abs = d1.readLine();
    outputArea1.setText("");
    outputArea1.append(abs + "\n\n");
    outputArea1.setCaretPosition(0);
    // Close our input and output stream
    fin1.close();
    catch (IOException e5) {
    JOptionPane.showMessageDialog(this, "Error Opening File", "Error", JOptionPane.ERROR_MESSAGE);
    } // end catch
    } // end else
    } // end private
    My question is: Can I force it to open files from a specific directory, and NOT from MyDocuments directory????
    thanks,
    vxc

    \r = return
    \n = linefeed
    \j = illegal escape character
    JFileChooser fileChooser = new JFileChooser("C:\j2sdk1.4.2\bin");
    You could/should use:
    (new File).pathSeparator
    or
    (new File).pathSeparatorChar
    and
    (new File).separator
    or
    (new File).separatorChar
    http://java.sun.com/j2se/1.4.1/docs/api/java/io/File.html

Maybe you are looking for

  • Useful Life in Dep Key "to the day"

    Hi, we have two depreciation areas one for IN gaap and the other for US GAAP. In GAAP has depreciation keys with "to the day" feature and the US GAAP has depreciation keys created with useful life feature. Now the issue is since useful life has got n

  • Finder window won't open on the desktop when rebooting in Lion

    One problem that I have is: I always have a finder window open on my desktop. In Lion 10.7.1, when I shut down and restart my Macbook Pro (15 inch early 2008), the finder window will appear momentarily then close itself, leaving empty desktop and dri

  • ICloud on MacBookPro not my primary account?

    I'm in a mess.  Why am I getting this mesage when I click on tyhe iCloud icon in System Preferences?  I don't seem to be able to make it my primary account because if I attempt to log out the darn thing wants to remove email, calendars, Uncle Tom Cob

  • Image Capture - Download?

    My computer was running low on memory, so I deleted some programs that I thought I'd never use. (Seeing as this is mostly my 'away from home, connect to internet only' computer, I didn't think I'd need a lot of the programs.) It looks like I needed I

  • My iPhone contacts disappeared. Is it possible to make backup?

    Today I cannot acces to the setiings in my iphone, so i switched it off and when i switched on, all my iphone contacts were gone. Is it possible to make some backup of the contacts? Thank you in advance for your help