Sponsored Content
Top Forums Shell Programming and Scripting Multiple Files deletion in perl Post 302166518 by pulkit on Tuesday 12th of February 2008 04:48:48 AM
Old 02-12-2008
Multiple Files deletion in perl

Hello Friends,

I want to delete all the "*.trg" files in a directory but i don't want to do it by

system("rm -r *.trg");

Can i do it thru unlink or by any other mean

Thanks,
Pulkit
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Adding 3 Lines to Multiple c and h files with perl

Hello, i need some help with a perl script. i need to add the lines: #ifdef LOGALLOC #include "logalloc.h" #endif // LOGALLOC To all c and h files in a project with subdirectories. Logalloc is a tool to log all *alloc and free's in a text file, it defines the *alloc funtions new.... (2 Replies)
Discussion started by: Lazzar
2 Replies

2. Shell Programming and Scripting

Combining Multiple files in one in a perl script

All, I want to combine multiple files in one file. Something like what we do on the commad line as follows -> cat file1 file2 file3 > Main_File. Can something like this be done in a perl script very efficiently? Thanks, Rahul. (1 Reply)
Discussion started by: rahulrathod
1 Replies

3. Shell Programming and Scripting

Regarding deletion of old files

Hi, I have a list of directories which contain old files that are to be deleted. I put the list of all directories in a txt file and it is being read by a script Iam searching for the files older than 60 days using mtime and then deleting it But all the files are getting deleted... (3 Replies)
Discussion started by: Chidvilas
3 Replies

4. Shell Programming and Scripting

Perl program to read from multiple files

Hi, I need to generate a test data file by reading inputs from multiple files. A sample pseudo code for this program to read from three files and write to a output file would be like: open(OUTPUTFILE, "data"); open(INFILE1, "data1"); open(INFILE2, "data2"); open(INFILE3, "data3"); ... (1 Reply)
Discussion started by: jyotipg
1 Replies

5. UNIX for Dummies Questions & Answers

Line deletion help using perl -ne

Hi all, I know the one liner to delete all the lines in a file which matches a pattern i.e perl -i.old -ne 'print unless /pattern/' file Now i need the perl onliner to delete all the lines which doesnt match the pattern. Also what is the difference between perl -i and perl -i.old. Does... (1 Reply)
Discussion started by: lijju.mathew
1 Replies

6. Shell Programming and Scripting

blank line deletion in a file using perl

Dear All, I am looking for an option in perl using which i could delete empty lines in a file. Or the alternative of sed '/^$/d' <filename> in perl. Sed is not working in my perl script :( Pls help me out . Thanks, VG (4 Replies)
Discussion started by: vguleria
4 Replies

7. Shell Programming and Scripting

perl script on multiple files

I have a script that runs on one file (at a time). like this: $> perl myscript.pl filename > output How can I run it on >6000 files and have the output sent out into slightly modified file name $> perl myscript 6000files> output6000files.new extension Thanks in anticipation (4 Replies)
Discussion started by: aritakum
4 Replies

8. UNIX for Dummies Questions & Answers

Grep in Perl - Searching through multiple files

I'm attempting to use grep in Perl with very little success. What I would like to do in Perl is get the output of the following grep code: grep -l 'pattern' * This gives me a list of all the files in a directory that contain the pattern that was searched. My attempts to do this in Perl... (4 Replies)
Discussion started by: WongSifu
4 Replies

9. Shell Programming and Scripting

perl: search replace in multiple files

When I use special characters the command to replace multiple files with a string pattern does nt work. ---------- Post updated at 12:33 PM ---------- Previous update was at 11:38 AM ---------- This works perl -pi -e 's/100/test/g' * This does nt work perl -pi -e 's... (1 Reply)
Discussion started by: w020637
1 Replies

10. Shell Programming and Scripting

deletion of multiple occurring files

Hi all, In the given file, what I need to do is to select double (or triple) occurring files and delete the one having smaller file size. And would like to keep the one with the big file size. 518t-rw-r--r-- 1 emily us_cms 101348458 Oct 8 16:43 vgtree_518_0_LHB.root 518t-rw-r--r-- 1... (9 Replies)
Discussion started by: emily
9 Replies
Padre::Task::File(3pm)					User Contributed Perl Documentation				    Padre::Task::File(3pm)

NAME
Padre::Task::File - File operations in the background SYNOPSIS
# Recursively delete Padre::Task::File->new( remove => 'C:fooaraz', )->schedule; DESCRIPTION
The File::Remove CPAN module is a specialised package for deleting files or recursively deleting directories. As well as providing the basic support for recursive deletion, it adds several other important features such as removing readonly limits on the fly, taking ownership of files if permitted, and moving the current working directory out of the deletion path so that directory cursors won't block the deletion (a particular problem on Windows). The task takes the name of a single file or directory to delete (for now), and proceeds to attempt a recursive deletion of the file or directory via the File::Remove "remove" method. In the future, this module will also support more types of file operations and support the execution of a list of operations. METHODS
new my $task = Padre::Task::File->new( remove => '/foo/bar/baz', ); Creates a new deletion task. Takes a single parameter "remove" which must be an absolute path to the file to delete (as the "current directory" may change between the time the removal task is created and when it is executed). remove The "remove" accessor returns the absolute path of the file or directory the task will try to delete (or tried to delete in the case of completed tasks). SEE ALSO
Padre, Padre::Task, File::Remove COPYRIGHT
Copyright 2008-2012 The Padre development team as listed in Padre.pm. This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5 itself. The full text of the license can be found in the LICENSE file included with this module. perl v5.14.2 2012-06-27 Padre::Task::File(3pm)
All times are GMT -4. The time now is 10:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy