CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Read from .txt, find in folder then delete

 



forro
New User

Oct 26, 2012, 12:44 AM

Post #1 of 4 (701 views)
Read from .txt, find in folder then delete Can't Post

Hello all,

I am trying to ease my work by creating a script to do what I manually do every week:

I have a .txt file with .png file names:
230.png
34.png
.
.

I would like to read the txt file (solved) then to search the files on my system (for eg. "/pictures/new/"), extract the file path (for eg. "/pictures/new/230.png") and then to delete those results / files.

It would help me a lot to solve this.

I am 1/4 through the Begginer's Lama book so I need some help with this to reach the deadline.

Thank you,


wickedxter
User

Oct 26, 2012, 2:21 AM

Post #2 of 4 (699 views)
Re: [forro] Read from .txt, find in folder then delete [In reply to] Can't Post

open file

#use this only if the file is small less than 100mb
@file =file handle; this sulrps the hole file

open dir
@dir = readdirr;

loop file
loop dir
setup some matches

.........ect


Laurent_R
Enthusiast / Moderator

Oct 26, 2012, 3:00 AM

Post #3 of 4 (693 views)
Re: [forro] Read from .txt, find in folder then delete [In reply to] Can't Post

Hi,

take a look at the folowwing module: File::Find.

It parses directory trees to look for files. This will probably do what you need.


forro
New User

Oct 26, 2012, 3:26 AM

Post #4 of 4 (692 views)
Re: [Laurent_R] Read from .txt, find in folder then delete [In reply to] Can't Post

Thank you all,

I will try this tonight and if I get stuck I will come back with some code sample to find the error(s).

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives