September 4, 201510 yr I need to search an HTML document for all the image files (gif,jpg.png) then print out the list of images; then search on a server for the image files printed from the previous list and take those image files which on in a directory or directories on the server and move them to another directory on the server ?
September 4, 201510 yr Do you mean move or copy? If you move the images to another directory then if they are statically linked in the HTML page they will not appear on the page as the link paths will be broken. Is this some sort of online function for users to break the pages or something else?
September 4, 201510 yr Author I mean move. I know the links in the HTML will be broken; which is why I want to do this
September 4, 201510 yr Why not just access the server using your FTP client and rename the folder in which the images are stored?
September 7, 201510 yr Author There may be a more efficient way than this but I would probably: Use curl inside a php script to scrape the HTML page. Iterate over the nodes in the HTML and use a regular expression to pull out the image paths that you want into a list. I'd then ssh onto the server and use mv commands to move the files in the list. I hope that makes some kind of sense? Makes sense; does such a script exist ?
Create an account or sign in to comment