473,320 Members | 1,691 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to retrieve Last modified Date of a ftp directory

Is there any way I can retrieve Last modified Date of a ftp directory. i tried
$date_string = ftp->mdtm($directoryname)

But i get the error "File not found"
May 17 '10 #1
3 6720
You probably need to prefix the directory with "..\\" or possibly fully qualify the directory name from the root. Alternatively, you may need to further escape the prefix text depending on your OS. It looked like a DOS-like message, so I used that syntax.

The message you received as the error is exactly the behavior of being in the directory and issuing a DIR MYDIR command, where MYDIR is the name of your directory.

Other possible solutions include:
$datetime=ftp->mdtm(".");
$datetime=ftp->mdtm("../$directory");
$datetime=ftp->mdtm("..\\$directory");

Sometimes you will run into a situation where a period (.) needs to be escaped, but that is in regular expressions. So if you need to build a variable using regular expressions then it may be required to escape those special characters so they will function as literals.

You may also need to explicitly set your directory with a CD command (ftp->cd) if you are using relative directory names.

Gurydian
May 18 '10 #2
It worked.
Thanks :)
May 20 '10 #3
Thanks it helps me out also..

FTP->mtdm($file) function works for absolute path only.

$file should be complete path from root onward.

if we set root path dir1/dir2

and acutal file is inside of dir1/dir2/dir3/dir4/file...

then path of file should be /dir3/dir4/file ...
Dec 3 '14 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Rich Pasco | last post by:
The PERL statement I use to open a text file looks like this: open(HANDLE, $filename); Now how can I get the "last modified" date of that file? I need a solution that works the same under Windows...
11
by: Dennis Marks | last post by:
There seems to be a major program with the automatic display of the last modified date. Using the javascript "document.lastModified" sometimes returns the correct date and sometimes 1 Jan 1970...
5
by: Boniface Frederic | last post by:
Hi, Is it possible to know the last modified date of a text file in javascript. Any help would be appreciated. Thanks. Fred.
4
by: IdleBrain | last post by:
Hello All, Is it possible to obtain the last Modified date for the source code from within the application? If yes, please let me know how it is done.
1
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I format Last Modified date with javascript...
1
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I format the Last-Modified date with javascript?...
7
by: mariyana | last post by:
How can we get the last accessed date and the last modified date of a file using VB6
1
by: sudkum | last post by:
Hi, i am just trying to get the last modified date/time of a trx file trough batch file is this possible. I need this to use in copy statement like, i just wanted to copy newly...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.