Getting the file creation time using Net::FTP

Hi to All,
Currently, I'm doing a script using the Net::FTP module, this script will
just get all the files created on a particular date.
The problem right now (which I'm stuck) is that some files don't have
creation date and time included in their filename
so there's no way I can get those files by not specifying the creation
time.
Base on the man page for Net::FTP, mdtm() returns the modification time of
the file but it did not return anything.
Here's a snippet:

$file = "sample_file";

$ftp = Net::FTP->new("hostname");
$ftp->login("username","password");
$timestamp = $ftp->mdtm("$file");
      or die "can't get the time of $file: $!\n";
$ftp->quit;

print $timestamp;

II I execute this script, it will be terminated because there no return
value at mdtm...

Pls. help........

Thanks.

Best Regards,
Richard

[This e-mail is confidential and may also be privileged. If you are not the
intended recipient, please delete it and notify us immediately; you should
not copy or use it for any purpose, nor disclose its contents to any other
person. Thank you.]


0
richardb
5/5/2003 7:27:42 AM
perl.beginners 29388 articles. 4 followers. Follow

1 Replies
798 Views

Similar Articles

[PageSpeed] 51

Hi Richard.

FTP isn't very good about giving yout directory
information. The only way of finding out whether
you're dealing with a link or a directory, for
instance, is to issue a LIST command.


richardb@stats.st.com.sg wrote:
> Hi to All,
> Currently, I'm doing a script using the Net::FTP module, this script will
> just get all the files created on a particular date.
> The problem right now (which I'm stuck) is that some files don't have
> creation date and time included in their filename
> so there's no way I can get those files by not specifying the creation
> time.
> Base on the man page for Net::FTP, mdtm() returns the modification time of
> the file but it did not return anything.
> Here's a snippet:
>
> $file = "sample_file";
>
> $ftp = Net::FTP->new("hostname");
> $ftp->login("username","password");
> $timestamp = $ftp->mdtm("$file");
>       or die "can't get the time of $file: $!\n";

If your file isn't a plain faile the MDTM command
will often fail - it depends on the server. To find
out what's gone wrong try:

    $timestamp = $ftp->mdtm($file) or die $ftp->message;

BTW never put quotes around isolated scalars unless you
particularly want the transformation this forces.

> $ftp->quit;
>
> print $timestamp;
>
> II I execute this script, it will be terminated because there no return
> value at mdtm...
>
> Pls. help........

At least you'll find out the reason for the failure. Take
a look at

    perldoc Net::Cmd

as well. This lists additional methodsfor the Net::Ftp
object because a base class for it.

HTH,

Rob




0
rob
5/5/2003 2:33:16 PM
Reply:

Similar Artilces:

Files uploaded using asp.net to Ftp site not persisting, after the webserver.exe is closed or automatically after some time
Hi All, Below mentioned is the code i have written to upload files to ftp site, but after I perform the upload. The files automatically vanishes after some time or immediately when I close the Webserver.exe process during development. I am not able to understand the reason. Please Help. private bool UploadFiles(ListItemCollection lstLocalFilePath) {string strCompleteFTPPath = ConfigurationManager.AppSettings["FTP_SUPPORT_DOCUMENT_UPLOAD_PATH"].ToString(); string strFilePrefix = "SupportDoc";long lngCaseID = 25; long lngHeaderID = 25;long lngLineID...

How to upload large files through FTP using Asp.net and VB.net
Hi, I want you to tell me that how can i upload the large files through FTP using asp.net and vb.net. I have developed a page where user can upload his/her file which is about 1-5 mb but if file size increase upto 50 mb then my page do not work. If i try so, then find the following error: The web application you are attempting to access on this web server is currently unavailable. Please hit the "Refresh" button in your web browser to retry your request. Administrator Note: An error message detailing the cause of this specific request failure can be found in the application event log o...

Why is the difference between a uploaded file using VB6, ASP.NET and a uploaded file using ASP.NET FileUpload Server Control?
I'm trying to develop Active X file upload component using VB6. Like below list... Thanks for authors( Joseph Z. Xu (jzxu@napercom.com), Mohd Idzuan Alias (iklan2k@yahoo.com)). --Client File upload Program source  Dim WinHttpReq As WinHttp.WinHttpRequestConst HTTPREQUEST_SETCREDENTIALS_FOR_SERVER = 0Const HTTPREQUEST_SETCREDENTIALS_FOR_PROXY = 1Const BOUNDARY = "Xu02=$"Const HEADER = "--Xu02=$"Const FOOTER = "--Xu02=$--" Function UploadFiles(strFileName As Variant, strURL As String, DirPath As String, Optional postVar As String, _   &...

How to get list of all wav files in one folder in ASP.Net using VB.Net 2003?
I have one folder on server in that there are few wav files. Now I want list of only those wav files which were last modified on yesterday. I have today's date, in that folder there will two types of wav files some are created today and some are created on yesterday. Now I want list of wav files those were created on yesterday. I am able to get list of files in that folder using - arrFileNames = Directory.GetFiles() But now how could I get the files which have extension on .wav and which were created on yesterday. I also know one method to get last modified date of part...

using GET of NET::FTP
get ($remote,$local,$where) is failing whenever i use the third arguement. here in this case my file to be downloaded from FTP is of size 5MB. 2Mb of it is downloaded, now when i am executing the get ($remote,$local,$where) with $where as 2MB(2048), get method is returning me nothing and download is getting aborted. can anybody plz help me out to solve this problem. ...

Keep getting..."Unable to get project file from server",when using vs.net
When trying to open any existing asp.net project in Visual Studio it keeps giving me the message above. It is also throwing an error when I create the project in the first place, it happens when a dos window is opened, the text in the dos window is running "Common Language Runtime Minidump Utility version 1.0.3705.0" and then VS craps out says there was an error and shuts down. I've re-installed the .net components and framework with no avail, and FrontPage extensions etc.. are all installed. I'm running XP professional and have installed IIS 5.1. This is driving me fec...

How to FTP files using ASP.net
I need to send files to a FTP server. Can you please tell me how this is possible using ASP.net?Thanks, Som Bhat With ASP.NET 1.x it's a little unpleasant, you need to download or write an FtpWebRequest (that inherits from System.Net.WebRequest) and use it to upload the files. (I'm assuming that your FTP server isn't also an HTTP server). There are samples of this: http://www.gotdotnet.com/workspaces/workspace.aspx?id=df40d855-4ac0-4253-a232-a0f1137f5fd9 http://support.microsoft.com/default.aspx?scid=kb;EN-US;812409TTFN - Kent...

How can I get the creation time of a file?
In PowerBuilder 7.0: How can I get the creation time of a file? Thanks Take a look at the PFC file service object. In particular, of_GetCreationDateTime. If you did not install PFC, it is basically calling the FindFirstFileA SDK function. HTH, steve [TeamSybase] Ricardo Mayor wrote: > > In PowerBuilder 7.0: > > How can I get the creation time of a file? > > Thanks ...

How to ftp a file
server: ftp.mysite.comusername: adminpassword: adminpath: /images/ I have the following code which saves the file to C: drive as test.tif. So, can i ftp the same file to the above site directly instead of saving it to harddrive. <code>I am actually doing the following: by using the same code logic can i ftp it or if there is another method can you please show me.Dim proc As ProcessStartInfo = New ProcessStartInfo proc.Arguments = "c:\test.tif -feederon -h -n -r 200 -multipagetiff -o"Process.Start(proc)</code> Thank you very much for the information....

Accessing file twisely using asp.net using VB.Net
Hello Friends, I am new on this group. I have a problem in my functionality. i am using asp.net using vb.net. The pocess is as  a way that I have to send a mail with attachment.I am using Input file type tag control to get Attachment file from directory.After it i am saving attachment file on server folder.After it i am sending file path to attachment function as string.After it attachment is working fine. But after it i want to delete that file from server and when i wrote code  for delete fileas following: File.delete(Path of file) but when runtime start execute this code ...

HOW to use File Field to upload file? ( use ASP.net 1.0)
  I drag a "file field control" to page like below, I am going to buile a file upload web. the request is first I have to build a report file for save the upload file for example : I buile a file name " Company A" and which including a file name "BAK" on webserver when I uploading a file name "Company A" and then the uploading file will be putted on BAK file of Company A if we don't have the match name with the uploading file  on webserver then we don't upload this file.   my question is  1. how to use file field ...

Getting a whole directory using Net::FTP
Hi, I would like to upload and download files to a Linux server from my Windows machine. So, I set out to write a little script that does just that. Uploading, it turns out, is no problem. I use an "opendir" statement to open the directory, then readdir to read its contents and then each file gets "put". This works and so, I thought, that's what I'll do for downloading files too. However, I don't seem to be able to open the remote directory. I get the message that the $dir cannot be opened ("Ik kan $dir niet openen!"). I added a snippe...

getting files list in the order of creation time
Let me explain I have one parant folder which contain subfolders and the sub folders contains files. 1. I want to get the Subfolders in the order of their content updated. 2. i want to get the file list of each subfolder in the order of creation time. Hope that my question is clear thanks in advanceStand up for what you believe in, even if it means standing alone.Blog | Download Songs Hmmmm I see several solutions to your issue: A moderately complicated generic list structure or a master-child datatable in a dataset structure. The reason I say that is you want to be able to so...

how to get file's creation time
hi, How to get file's creation time,NOT last modify time?Thanks. ----- Original Message ----- From: Jennifer Garner <JenGarner@30gigs.com> Date: Monday, November 28, 2005 12:30 pm Subject: how to get file's creation time > How to get file's creation time,NOT last modify time?Thanks. I don't think it is possible, in unix environment. Read this comment by Randall Schwartz, http://www.perlmonks.org/index.pl?node_id=479799 Hope it gives you a hint ... --- Regards, Edward WIJAYA SINGAPORE -----------------------------------------...

Web resources about - Getting the file creation time using Net::FTP - perl.beginners

Institute for Creation Research - Wikipedia, the free encyclopedia
The Institute for Creation Research (ICR) is a Christian apologetics institute in Dallas , Texas that specializes in education, research, and ...

Curtin University meteorite discovery could hold clues to solar system creation
It doesn't look like much, but a 1.7 kilogram rock discovered by a team from Curtin University on New Year's Eve could help solve the mystery ...

Patrice Washington on bankruptcy, finance and wealth creation
PATRICE Washington found herself $US2million ($A2.74 million) in debt in 2007 as the American subprime mortgage market started to crumble.

Shizup Meme, GIF Creation App Launches on iOS, Android
Shizup has announced the launch of its meme and GIF creation app on iOS and Android. The app allows users to create memes by combining text they ...

D&D 5e opens up, lets adventurers sell creations in print and online
... time building adventures and characters for the fifth edition of Dungeons & Dragons , you might be able to make a little money from your creations ...

How Google Panda Affected Website Creation
Business 2 Community How Google Panda Affected Website Creation Business 2 Community Danny Sullivan of Search Engine Land had discovered a ...

Private job creation surges in Dec
Private companies created far more jobs than expected, a bright sign for an economy that has been struggling.

How Nexo Knights Became Lego's Latest Blockbuster Original Creation
Take a look behind the brand's new future tech-meets-Medieval Times toys, cartoon, and digital app. Our story begins in the Kingdom of Knighton ...

How To Scale Content Creation To Your Advantage
Content creation is important but community engagement is key. As the King of your tribe, entrepreneurs must use content more like a Queen and ...

Microsoft's Latest iOS Creation Is a Selfie App We Don't Need But Whatever
For over a year, Microsoft’s been doing something interesting by making great apps for other mobile operating systems, like Android’s Arrow Launcher ...

Resources last updated: 1/20/2016 5:43:55 PM