User Profile

Collapse

Profile Sidebar

Collapse
perlrmhu
perlrmhu
Last Activity: Mar 28 '12, 07:10 AM
Joined: Dec 18 '11
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • perlrmhu
    started a topic How to list files by file creation time
    in Perl

    How to list files by file creation time

    I need to print files in a Windows directory by file creation time, not by file name. I am using the Net::SFTP::Fore ign. I tried to use "ordered => 2" on $sftp->ls but the files are still printed by file name. I really appreciate if anyone can help. Below is the code.
    Code:
    $sftp->ls('myDirectory', ordered => 2, wanted => sub {
            if ( $_[1]->{longname} =~ /^d/ ) {
                $dircount++;
    ...
    See more | Go to post

  • perlrmhu
    replied to How to read and write a single character?
    in Perl
    Thank you Chorny. The code you suggested works great! Can you please let me know how to write the single character "0" replacing "1" on the line in the file? Thanks,
    See more | Go to post

    Leave a comment:


  • perlrmhu
    started a topic How to read and write a single character?
    in Perl

    How to read and write a single character?

    I need to read a file on Unix server that has only one line with a character on it. My script needs to read in the character. If the character is 1, the script stops and exit. Otherwise, the script runs. Befoere the scripts ends, write the "0" to replace "1". I wrote some code like below. but it does not work and get error of "Reference to nonexistent group in regex; marked by <-- HERE in m/^\1 <-- HERE /". Can...
    See more | Go to post

  • thanks to both of you: numberwhun and RonB.
    See more | Go to post

    Leave a comment:


  • I added the $! into the print line. I had "No such file or directory". I double-checked the file name and directory. I did not find anything wrong. I tried to use $sftp->move command to move the file. But I get "Can't locate object method "move" via package "Net::SFTP" ". I am wondering if sftp can support the move?
    See more | Go to post

    Leave a comment:


  • How to move files from one folder to another folder with sftp Perl

    I have files in ToTransfer folder on remote windows server. I need to move them to ToTransfre\Tran sferred folder. I am using sftp. The code below did not give me compile error but it did not work either. Can anyone please let know how to get it working?

    Code:
    unless(move("ToTransfer\\$filelist[$li]->{filename}", "ToTransfer\\Transferred"))
                {
                 print "Couldn't move the
    ...
    See more | Go to post

  • RonB, The windows server I want to test the Perl code is down during the holidays. I will try what you suggested as soon as the server is up. thanks,
    See more | Go to post

    Leave a comment:


  • Sorry. That is my mistake. That line should not be commented out. I played around with different ssh connections. I forgot to remove the comment sign when I posted my questions.

    Thanks,

    Randy
    See more | Go to post

    Leave a comment:


  • How to change directory on Windows server using ssh?

    I use ssh connection to connect to a Windows server from a Linux server. The connection is made to the E:\FTP working directory. I need to change directory to E:\pilot\dev_te st directory. I run the code as below. I had error on the windows server: "[057] RSSHD 7.00: .\sshd.cpp:Wind owsSessionServe r::HandleProces sExit(8052) Session server 294: Executing command in working directory...
    See more | Go to post
    Last edited by perlrmhu; Dec 19 '11, 04:26 PM. Reason: provide additional info.

    Leave a comment:


  • How to change directory on Windows server using ssh connection

    I use ssh password-less connection to connect to a Windows server from a Linux server. The connection is made to the E:\FTP working directory. I did a dir to list the file in the working directory. I had no output. I need to change directory to E:\pilot\dev_te st directory.
    I tried to use chdir(). It did not work. Followings are the code. Can anyone please help?
    Code:
    #!/usr/local/bin/perl
    use Net::SSH::Perl;
    use Net::SCP::Expect;
    ...
    See more | Go to post
    Last edited by numberwhun; Dec 20 '11, 07:35 AM. Reason: Please use code tags!
No activity results to display
Show More
Working...