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: Need a Custom or Prewritten Perl Program?: I need a program that...:
Delete a dir UNC path

 



FrankToy
New User

Feb 17, 2009, 2:15 AM

Post #1 of 2 (2115 views)
Delete a dir UNC path Can't Post

Hi,

I want to delete a complete directory (direc5.x) in the following structure ...
There are several directories called Proofview.x and several directories underneath direc4

This has to be done using a UNC path.

\\my_server\s$\Program"]\\my_server\s$\Program Files\direc1\direc2\direc3\Proofview.1\direc4\direc5.0
\\my_server\s$\Program"]\\my_server\s$\Program Files\direc1\direc2\direc3\Proofview.1\direc4\direc5.1
\\my_server\s$\Program"]\\my_server\s$\Program Files\direc1\direc2\direc3\Proofview.1\direc4\direc5.2
\\my_server\s$\Program"]\\my_server\s$\Program Files\direc1\direc2\direc3\Proofview.2\direc4\direc5.0
\\my_server\s$\Program"]\\my_server\s$\Program Files\direc1\direc2\direc3\Proofview.3\direc4\direc5.0
\\my_server\s$\Program"]\\my_server\s$\Program Files\direc1\direc2\direc3\Proofview.3\direc4\direc5.1
...

Is there anyone who can help me out ?

tia


gnix
Novice

Feb 17, 2009, 4:02 PM

Post #2 of 2 (2103 views)
Re: [FrankToy] Delete a dir UNC path [In reply to] Can't Post

Hi,

I am not sure that it will work, but maybe with glob and unlink you can delete these files. Here an example of source code:


Code
#!/usr/bin/perl -w 

@files = glob("\\my_server\s$\Program"]\\my_server\s$\Program Files\direc1\direc2\direc3\Proofview.*\direc4\direc5.*");

foreach $file (@files) {
if(unlink($file)) {
print "$file deleted\n";
}
}


Let me know if it works. Wink
gnix

ps: Sorry for my English.

 
 


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

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