Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Web Coding › Requesting list of files from website directory [RESOLVED]
New Posts  All Forums:Forum Nav:

Requesting list of files from website directory [RESOLVED]

post #1 of 15
Thread Starter 
Let's say there was some file hosted at www.website.com/~bob/class123/file.pdf. All the files under /class123/ like file.pdf are publicly accessible, but that directory is a website in itself, so it doesn't list out the available files. Is there a way to request a list through some command? Like how I can just type in 'ls' in a terminal to get a list of files in my current directory.

EDIT: Doesn't look like there is a way to request the files without explicit directory listing, at least no straightforward way. Thanks all.
Edited by EfemaN - 10/23/12 at 1:29pm
Heavy
(13 items)
 
  
CPUMotherboardGraphicsRAM
Core i7-920 D0 3.8GHz @ 1.2V ASUS P6X58D Premium MSI GTX 670 Twin Frozr IV Corsair Vengeance 12GB DDR3-1600(C9) 
Hard DriveOSMonitorKeyboard
2x WD VR 150GB RAID 0 + 120GB Intel SSD 320 Windows 7 Ultimate 64-bit ASUS VW246H + Dell U2412M CM Quickfire Rapid (MX Blue) 
PowerCaseMouseMouse Pad
Corsair HX850W Antec Twelve Hundred Razer DeathAdder 3500 Razer Goliathus 
  hide details  
Reply
Heavy
(13 items)
 
  
CPUMotherboardGraphicsRAM
Core i7-920 D0 3.8GHz @ 1.2V ASUS P6X58D Premium MSI GTX 670 Twin Frozr IV Corsair Vengeance 12GB DDR3-1600(C9) 
Hard DriveOSMonitorKeyboard
2x WD VR 150GB RAID 0 + 120GB Intel SSD 320 Windows 7 Ultimate 64-bit ASUS VW246H + Dell U2412M CM Quickfire Rapid (MX Blue) 
PowerCaseMouseMouse Pad
Corsair HX850W Antec Twelve Hundred Razer DeathAdder 3500 Razer Goliathus 
  hide details  
Reply
post #2 of 15
I'm not sure I understand the Q, but what about "site:urlhere" in Google?
Main Rig.
(14 items)
 
Battlefield 2 review.
Battlefield 2 PC Game EA
 
CPUMotherboardGraphicsRAM
Bulldozer FX4100 Gigabyte GA-M68MT-S2 MSI 7770 Kingston Hyper X | 2 x 2 GB 
Hard DriveOptical DriveCoolingOS
WD 2 TB  LiteON DVD/CD R-W Drive AMD Standard cooler Windows 7 Ultimate 
MonitorKeyboardPowerCase
32' Luxor Full HD TV Microsoft comfort curce Antec 450 Watt OcUK Value case 
MouseAudio
Microsoft wireless mouse Logitech speakers & Bass 
  hide details  
Reply
Main Rig.
(14 items)
 
Battlefield 2 review.
Battlefield 2 PC Game EA
 
CPUMotherboardGraphicsRAM
Bulldozer FX4100 Gigabyte GA-M68MT-S2 MSI 7770 Kingston Hyper X | 2 x 2 GB 
Hard DriveOptical DriveCoolingOS
WD 2 TB  LiteON DVD/CD R-W Drive AMD Standard cooler Windows 7 Ultimate 
MonitorKeyboardPowerCase
32' Luxor Full HD TV Microsoft comfort curce Antec 450 Watt OcUK Value case 
MouseAudio
Microsoft wireless mouse Logitech speakers & Bass 
  hide details  
Reply
post #3 of 15
Code:
<?php echo exec("ls /your/directory/"); ?>
Server
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i7 2600k Intel H67DE PNY Verto 9600GT (Thanks to ihasfip!) 16GB G.Skill Ripjaws 1333Mhz 
Hard DriveOSMonitorPower
(3) Seagate 7200K 1TB (2) Hitachi 7200K.12 1TB Proxmox Samsung 17" Corsair GS600 
Case
Chenbro tower 
  hide details  
Reply
Server
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i7 2600k Intel H67DE PNY Verto 9600GT (Thanks to ihasfip!) 16GB G.Skill Ripjaws 1333Mhz 
Hard DriveOSMonitorPower
(3) Seagate 7200K 1TB (2) Hitachi 7200K.12 1TB Proxmox Samsung 17" Corsair GS600 
Case
Chenbro tower 
  hide details  
Reply
post #4 of 15
Thread Starter 
Quote:
Originally Posted by joshd View Post

I'm not sure I understand the Q, but what about "site:urlhere" in Google?

That actually worked pretty well. You have to rely on what Google has found on the website, but not bad! I'll have to keep that in mind.
Quote:
Originally Posted by ZFedora View Post

Code:
<?php echo exec("ls /your/directory/"); ?>

That's interesting. That's probably not something I can run locally and standalone, is it? I wouldn't know how to actually perform that command.
Heavy
(13 items)
 
  
CPUMotherboardGraphicsRAM
Core i7-920 D0 3.8GHz @ 1.2V ASUS P6X58D Premium MSI GTX 670 Twin Frozr IV Corsair Vengeance 12GB DDR3-1600(C9) 
Hard DriveOSMonitorKeyboard
2x WD VR 150GB RAID 0 + 120GB Intel SSD 320 Windows 7 Ultimate 64-bit ASUS VW246H + Dell U2412M CM Quickfire Rapid (MX Blue) 
PowerCaseMouseMouse Pad
Corsair HX850W Antec Twelve Hundred Razer DeathAdder 3500 Razer Goliathus 
  hide details  
Reply
Heavy
(13 items)
 
  
CPUMotherboardGraphicsRAM
Core i7-920 D0 3.8GHz @ 1.2V ASUS P6X58D Premium MSI GTX 670 Twin Frozr IV Corsair Vengeance 12GB DDR3-1600(C9) 
Hard DriveOSMonitorKeyboard
2x WD VR 150GB RAID 0 + 120GB Intel SSD 320 Windows 7 Ultimate 64-bit ASUS VW246H + Dell U2412M CM Quickfire Rapid (MX Blue) 
PowerCaseMouseMouse Pad
Corsair HX850W Antec Twelve Hundred Razer DeathAdder 3500 Razer Goliathus 
  hide details  
Reply
post #5 of 15
Quote:
Originally Posted by EfemaN View Post

That's interesting. That's probably not something I can run locally and standalone, is it? I wouldn't know how to actually perform that command.

put that in listfiles.php or some other file name with a php extension. Upload it to the directory where your files are and then access it from a web browser and you should see the results.
White TITAN
(16 items)
 
   
CPUMotherboardGraphicsRAM
intel core i7-3770k Asus Z77 Sabertooth EVGA Titan SC Corsair Dominator Platinum 16GB (2x8GB) 
Hard DriveHard DriveHard DriveOptical Drive
Samsung 840 Pro  WD Black Crucial M4 LG Blueray 
CoolingOSMonitorPower
Swiftech H220 Windows 7 64bit Dell 2311h Ultrasharp x 2 Corsair AX850 
CaseMouseMouse PadAudio
Fractal Design Define R4 White (w/ Window) Logitech G700 Razer Control Edition Sound Blaster ZxR 
CPUMotherboardGraphicsRAM
Intel 980x Asus Rampage iii Extreme EVGA GTX580 SLI Patriot Viper Xtreme 12GB DDR3 2000 (PC3 16000) 
Hard DriveHard DriveHard DriveOptical Drive
120GB Corsair Force Series 3 SSD WD Caviar Black 640GB Crucial M4 128GB SSD LG Black Blu-ray Drive SATA Model UH12LS28 
CoolingCoolingCoolingCooling
XSPC RX360 and RX120 Rads Watercool HeatKiller 3.0 Limited Edition Black ... XSPC Dual Bay Res with Swiftech MCP655 Pump Silver Shining Bitspower Compression Fittings 
CoolingCoolingCoolingCooling
PrimoFlex Pro LRT Black Tubing -1/2in. ID X 3/4in. 3x Gentle Typhoon 120mm Fan 1850RPM (AP-15)  1x Noiseblocker NB-BlackSilentPro PL-2 120mm Ul... Koolance VID-NX580 Full Cover GPU Waterblock x2 
OSMonitorKeyboardPower
Windows 7 Home Premium x64 Dell U2311 Ultrasharp x2 Max Keyboard Nighthawk X8 Semi-Custom - Mechani... Antec High Current Gamer 900W 
CaseMouseMouse PadAudio
Xigmatek Elysium Black Logitech G700 Razer Goliathus Creative Sound Blaster Recon3D Fatal1ty Pro 
  hide details  
Reply
White TITAN
(16 items)
 
   
CPUMotherboardGraphicsRAM
intel core i7-3770k Asus Z77 Sabertooth EVGA Titan SC Corsair Dominator Platinum 16GB (2x8GB) 
Hard DriveHard DriveHard DriveOptical Drive
Samsung 840 Pro  WD Black Crucial M4 LG Blueray 
CoolingOSMonitorPower
Swiftech H220 Windows 7 64bit Dell 2311h Ultrasharp x 2 Corsair AX850 
CaseMouseMouse PadAudio
Fractal Design Define R4 White (w/ Window) Logitech G700 Razer Control Edition Sound Blaster ZxR 
CPUMotherboardGraphicsRAM
Intel 980x Asus Rampage iii Extreme EVGA GTX580 SLI Patriot Viper Xtreme 12GB DDR3 2000 (PC3 16000) 
Hard DriveHard DriveHard DriveOptical Drive
120GB Corsair Force Series 3 SSD WD Caviar Black 640GB Crucial M4 128GB SSD LG Black Blu-ray Drive SATA Model UH12LS28 
CoolingCoolingCoolingCooling
XSPC RX360 and RX120 Rads Watercool HeatKiller 3.0 Limited Edition Black ... XSPC Dual Bay Res with Swiftech MCP655 Pump Silver Shining Bitspower Compression Fittings 
CoolingCoolingCoolingCooling
PrimoFlex Pro LRT Black Tubing -1/2in. ID X 3/4in. 3x Gentle Typhoon 120mm Fan 1850RPM (AP-15)  1x Noiseblocker NB-BlackSilentPro PL-2 120mm Ul... Koolance VID-NX580 Full Cover GPU Waterblock x2 
OSMonitorKeyboardPower
Windows 7 Home Premium x64 Dell U2311 Ultrasharp x2 Max Keyboard Nighthawk X8 Semi-Custom - Mechani... Antec High Current Gamer 900W 
CaseMouseMouse PadAudio
Xigmatek Elysium Black Logitech G700 Razer Goliathus Creative Sound Blaster Recon3D Fatal1ty Pro 
  hide details  
Reply
post #6 of 15
I don't see how ls will help here if the directory listing he wants is not even a directory under his control...
My System
(30 items)
 
"Zeus"
(13 items)
 
 
CPUMotherboardGraphicsRAM
Intel Core i5 2500K (4.5ghz @ 1.320v) Gigabyte Z68X-UD3R-B3 MSI R7970 Lightning Corsair 16GB (4x4GB) 
Hard DriveHard DriveHard DriveHard Drive
Plextor PX-256M5S 256GB Crucial M4 128GB Hitachi HDS721010CLA332 Hitachi HDS723020BLA642 
Hard DriveHard DriveHard DriveOptical Drive
Hitachi HDS723020BLA642 Hitachi HUA722010CLA330 WDC WD10EARS-00Z5B1 TSSTcorp CDDVDW SH-S223B 
CoolingCoolingOSMonitor
Phanteks PH-TC14PE with TY-140's Lamptron FCv5 (x2) Windows 7 Ultimate 64-bit Dell U2412M 
MonitorMonitorMonitorKeyboard
Dell U2412M Dell U2212HM Dell U2212HM Ducky DK9087 G2 Pro 
PowerCaseMouseMouse Pad
Corsair AX-750 Corsair Obsidian 650D Microsoft IntelliMouse Optical  XTRAC Ripper XXL 
AudioAudioAudioAudio
Westone W3 IEMs RE-272 IEMs Shure SE-215 IEMs Schiit Bifrost DAC 
AudioAudio
Schiit Asgard 2 amp HiVi Swan M50W 2.1 
CPUMotherboardGraphicsRAM
Intel Core i7 950 GA-X58-UD3R Radeon HD 5450  24GB Corsair @ 1333mhz 
Hard DriveOSPowerCase
4x WD Cavair Red 1TB in RAID 0 Windows Server 2008 R2 x64 Corsair HX-520 LianLi LanCool 
  hide details  
Reply
My System
(30 items)
 
"Zeus"
(13 items)
 
 
CPUMotherboardGraphicsRAM
Intel Core i5 2500K (4.5ghz @ 1.320v) Gigabyte Z68X-UD3R-B3 MSI R7970 Lightning Corsair 16GB (4x4GB) 
Hard DriveHard DriveHard DriveHard Drive
Plextor PX-256M5S 256GB Crucial M4 128GB Hitachi HDS721010CLA332 Hitachi HDS723020BLA642 
Hard DriveHard DriveHard DriveOptical Drive
Hitachi HDS723020BLA642 Hitachi HUA722010CLA330 WDC WD10EARS-00Z5B1 TSSTcorp CDDVDW SH-S223B 
CoolingCoolingOSMonitor
Phanteks PH-TC14PE with TY-140's Lamptron FCv5 (x2) Windows 7 Ultimate 64-bit Dell U2412M 
MonitorMonitorMonitorKeyboard
Dell U2412M Dell U2212HM Dell U2212HM Ducky DK9087 G2 Pro 
PowerCaseMouseMouse Pad
Corsair AX-750 Corsair Obsidian 650D Microsoft IntelliMouse Optical  XTRAC Ripper XXL 
AudioAudioAudioAudio
Westone W3 IEMs RE-272 IEMs Shure SE-215 IEMs Schiit Bifrost DAC 
AudioAudio
Schiit Asgard 2 amp HiVi Swan M50W 2.1 
CPUMotherboardGraphicsRAM
Intel Core i7 950 GA-X58-UD3R Radeon HD 5450  24GB Corsair @ 1333mhz 
Hard DriveOSPowerCase
4x WD Cavair Red 1TB in RAID 0 Windows Server 2008 R2 x64 Corsair HX-520 LianLi LanCool 
  hide details  
Reply
post #7 of 15
You can't see the directory content if there's an index or if directory listing is disabled with htaccess.

But you can grab all the links of a website by following each link. Get the content of a page (cURL or file_get_contents), search through it for links (preg_match_all for href), put them into an array. Use a loop to follow the pages in your array and make sure you don't follow the same page multiple times. Then put out the results in a nice table.
DLC 2.0
(12 items)
 
  
CPUMotherboardGraphicsRAM
i7 2700K @ 4.8 GHz ASUS P8Z68-V PRO/GEN3 Sapphire 7970 GHz Corsair Vengeance LP 8 GB 
Hard DriveHard DriveOptical DriveCooling
Crucial m4 128 GB WD Caviar Black 1 TB ASUS DRW-24B3ST Noctua NH-D14 
MonitorPowerCaseMouse
ASUS PA248Q Seasonic X-850 Cooler Master HAF X Razer DeathAdder 
  hide details  
Reply
DLC 2.0
(12 items)
 
  
CPUMotherboardGraphicsRAM
i7 2700K @ 4.8 GHz ASUS P8Z68-V PRO/GEN3 Sapphire 7970 GHz Corsair Vengeance LP 8 GB 
Hard DriveHard DriveOptical DriveCooling
Crucial m4 128 GB WD Caviar Black 1 TB ASUS DRW-24B3ST Noctua NH-D14 
MonitorPowerCaseMouse
ASUS PA248Q Seasonic X-850 Cooler Master HAF X Razer DeathAdder 
  hide details  
Reply
post #8 of 15
Thread Starter 
Quote:
Originally Posted by tompsonn View Post

I don't see how ls will help here if the directory listing he wants is not even a directory under his control...

Oooh, I thought that was obvious, my bad. I'd like to view the files in a directory, similar to how they'll show up in an old-school list in the browser if the directory is public.
Quote:
Originally Posted by villain View Post

You can't see the directory content if there's an index or if directory listing is disabled with htaccess.

But you can grab all the links of a website by following each link. Get the content of a page (cURL or file_get_contents), search through it for links (preg_match_all for href), put them into an array. Use a loop to follow the pages in your array and make sure you don't follow the same page multiple times. Then put out the results in a nice table.

Heavy
(13 items)
 
  
CPUMotherboardGraphicsRAM
Core i7-920 D0 3.8GHz @ 1.2V ASUS P6X58D Premium MSI GTX 670 Twin Frozr IV Corsair Vengeance 12GB DDR3-1600(C9) 
Hard DriveOSMonitorKeyboard
2x WD VR 150GB RAID 0 + 120GB Intel SSD 320 Windows 7 Ultimate 64-bit ASUS VW246H + Dell U2412M CM Quickfire Rapid (MX Blue) 
PowerCaseMouseMouse Pad
Corsair HX850W Antec Twelve Hundred Razer DeathAdder 3500 Razer Goliathus 
  hide details  
Reply
Heavy
(13 items)
 
  
CPUMotherboardGraphicsRAM
Core i7-920 D0 3.8GHz @ 1.2V ASUS P6X58D Premium MSI GTX 670 Twin Frozr IV Corsair Vengeance 12GB DDR3-1600(C9) 
Hard DriveOSMonitorKeyboard
2x WD VR 150GB RAID 0 + 120GB Intel SSD 320 Windows 7 Ultimate 64-bit ASUS VW246H + Dell U2412M CM Quickfire Rapid (MX Blue) 
PowerCaseMouseMouse Pad
Corsair HX850W Antec Twelve Hundred Razer DeathAdder 3500 Razer Goliathus 
  hide details  
Reply
post #9 of 15
Trust me, if you're running a linux system, do what I posted, it'll list the contents of a directory of your choice.
Code:
<?php echo exec("ls /your/directory/"); ?>
Code:
<?php echo system("ls /your/directory/"); ?>
Code:
<?php echo passthru("ls /your/directory/"); ?>
Server
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i7 2600k Intel H67DE PNY Verto 9600GT (Thanks to ihasfip!) 16GB G.Skill Ripjaws 1333Mhz 
Hard DriveOSMonitorPower
(3) Seagate 7200K 1TB (2) Hitachi 7200K.12 1TB Proxmox Samsung 17" Corsair GS600 
Case
Chenbro tower 
  hide details  
Reply
Server
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i7 2600k Intel H67DE PNY Verto 9600GT (Thanks to ihasfip!) 16GB G.Skill Ripjaws 1333Mhz 
Hard DriveOSMonitorPower
(3) Seagate 7200K 1TB (2) Hitachi 7200K.12 1TB Proxmox Samsung 17" Corsair GS600 
Case
Chenbro tower 
  hide details  
Reply
post #10 of 15
Quote:
Originally Posted by EfemaN View Post

Oooh, I thought that was obvious, my bad. I'd like to view the files in a directory, similar to how they'll show up in an old-school list in the browser if the directory is public.

Oh right... as soon as I saw publicly accessible I assumed it were someone else's web server that you wanted to scrape the files from ;P
My System
(30 items)
 
"Zeus"
(13 items)
 
 
CPUMotherboardGraphicsRAM
Intel Core i5 2500K (4.5ghz @ 1.320v) Gigabyte Z68X-UD3R-B3 MSI R7970 Lightning Corsair 16GB (4x4GB) 
Hard DriveHard DriveHard DriveHard Drive
Plextor PX-256M5S 256GB Crucial M4 128GB Hitachi HDS721010CLA332 Hitachi HDS723020BLA642 
Hard DriveHard DriveHard DriveOptical Drive
Hitachi HDS723020BLA642 Hitachi HUA722010CLA330 WDC WD10EARS-00Z5B1 TSSTcorp CDDVDW SH-S223B 
CoolingCoolingOSMonitor
Phanteks PH-TC14PE with TY-140's Lamptron FCv5 (x2) Windows 7 Ultimate 64-bit Dell U2412M 
MonitorMonitorMonitorKeyboard
Dell U2412M Dell U2212HM Dell U2212HM Ducky DK9087 G2 Pro 
PowerCaseMouseMouse Pad
Corsair AX-750 Corsair Obsidian 650D Microsoft IntelliMouse Optical  XTRAC Ripper XXL 
AudioAudioAudioAudio
Westone W3 IEMs RE-272 IEMs Shure SE-215 IEMs Schiit Bifrost DAC 
AudioAudio
Schiit Asgard 2 amp HiVi Swan M50W 2.1 
CPUMotherboardGraphicsRAM
Intel Core i7 950 GA-X58-UD3R Radeon HD 5450  24GB Corsair @ 1333mhz 
Hard DriveOSPowerCase
4x WD Cavair Red 1TB in RAID 0 Windows Server 2008 R2 x64 Corsair HX-520 LianLi LanCool 
  hide details  
Reply
My System
(30 items)
 
"Zeus"
(13 items)
 
 
CPUMotherboardGraphicsRAM
Intel Core i5 2500K (4.5ghz @ 1.320v) Gigabyte Z68X-UD3R-B3 MSI R7970 Lightning Corsair 16GB (4x4GB) 
Hard DriveHard DriveHard DriveHard Drive
Plextor PX-256M5S 256GB Crucial M4 128GB Hitachi HDS721010CLA332 Hitachi HDS723020BLA642 
Hard DriveHard DriveHard DriveOptical Drive
Hitachi HDS723020BLA642 Hitachi HUA722010CLA330 WDC WD10EARS-00Z5B1 TSSTcorp CDDVDW SH-S223B 
CoolingCoolingOSMonitor
Phanteks PH-TC14PE with TY-140's Lamptron FCv5 (x2) Windows 7 Ultimate 64-bit Dell U2412M 
MonitorMonitorMonitorKeyboard
Dell U2412M Dell U2212HM Dell U2212HM Ducky DK9087 G2 Pro 
PowerCaseMouseMouse Pad
Corsair AX-750 Corsair Obsidian 650D Microsoft IntelliMouse Optical  XTRAC Ripper XXL 
AudioAudioAudioAudio
Westone W3 IEMs RE-272 IEMs Shure SE-215 IEMs Schiit Bifrost DAC 
AudioAudio
Schiit Asgard 2 amp HiVi Swan M50W 2.1 
CPUMotherboardGraphicsRAM
Intel Core i7 950 GA-X58-UD3R Radeon HD 5450  24GB Corsair @ 1333mhz 
Hard DriveOSPowerCase
4x WD Cavair Red 1TB in RAID 0 Windows Server 2008 R2 x64 Corsair HX-520 LianLi LanCool 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Web Coding
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Web Coding › Requesting list of files from website directory [RESOLVED]