Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

Cannot get the files from a directory in php

 
Ranch Hand
Posts: 83
Android Python Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to understand how all the different shopping sites might go about creating an entry of an item. I used the following code.

if you were to run this file, you would see that the only thing that shows up is a ".".
the code is also live on my website. the url to the files is  here. go ahead and download them if you want or use the url to read the files on your own pc. but the content of the first file is and the image is down below. thanks for all your help and i hope I can fix this problem.
001.jpg
[Thumbnail for 001.jpg]
the image mentioned in the txt file
 
Sheriff
Posts: 21922
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On Linux systems, each directory contains entry . which is the directory itself. Each non-root directory also has entry .. which is the parent directory. You'll need to go through the list of files and filter out these two entries. Right now you only print the first entry, which often is the . one.
 
Rocky Rocha
Ranch Hand
Posts: 83
Android Python Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That makes sense, thank you for your help! I remember seeing that, but I didn't know that it would affect getting a list of files from a directory.
 
Rob Spoor
Sheriff
Posts: 21922
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.
 
Don't MAKE me come back there with this tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic