...I want to write a script, that will delete all directories within /data/exports/ but not the 2000,2001 and 2002 found at that first level. The 200x found within daily and etc i want gone though.
...
any thoughts, help appreciated.
If you were on Linux, things would have been easier by using -mindepth option of GNU find. In this case we need first to sort the directories that aren't needed:
Test it first, by removing rm -r part, ( -p will prompt you ), to see if you have the all the desired directories. If you need the dirs that are named as numbers 200x, then change the find part to:
Hello,
I need a hand with a script im trying to make. I have a directory
/usr/db/mail with a bunch of subdirectories such as
/usr/db/mail/domain1.com
/usr/db/mail/domain2.com etc. etc.
all of these directories in turn have sub directories of their own. What I need to do is search all of... (1 Reply)
Hi.
I'm trying to write a script that will delete all directories found, that are not named as a "number" (year)...
here is what i mean, let's say i have within /data/exports the following directories:
/data/exports/2000
/data/exports/2001
/data/exports/2002
/data/exports/daily/2000... (5 Replies)
I am new to shell programming and have an assignment question which requires me to list the contents of the present working directory in 4 column format and highlight any subdirectories. It then requires me to develop the shell script to accept a directory name as a positional parameter (if no... (11 Replies)
Hi
I have 10 directories.I want to delete all the dicrectories except the three recent directories based on timestamp.I am new to BASH can u help me? (1 Reply)
Hi All
after looking around the website and various other resources I become stuck. I'm trying to rename directories from
Firstname Initial Lastname to lastname,_firstname_initial
so far ive got
for f in {./}
do
rename -n 'y/A-Z/a-z/' *
rename -n 's/\ /_/g' * ... (2 Replies)
Hi,
I have a requirement like,
I need to create the directory with date and time stap (i.e YYYYMMDDHMS) every day end need to delete the old directories which is 12 months old. I have tested with following script
cd /export/home/sbeeravo/; find . -type d -mtime +365 -exec rm -rf {} \;
... (2 Replies)
Hello,
I'm trying to figure out how best to approach this script, and I have very little experience, so I could use all the help I can get. :wall:
I regularly need to delete files from many directories.
A file with the same name may exist any number of times in different subdirectories.... (3 Replies)
I have a task, I usually do manually, but with growing responsibilities I tend to forget to do this weekly, I want to write a script that automates this, but I cant seem to work it out in my head, I have the shell of it out, but need help, and you guys have helped me with EVERY problem I have... (5 Replies)
Hello,
I need help in writing the shell script for below mentioned case.
There are 2 servers(server A, server B).
A cronjob syncs files between these 2 servers.
Existing script is copying files from A to B.
This is done using the command rsync.
However, the files are not deleted... (2 Replies)
Hello,
How would I write a BASH script to remove all sub directories in a root level directory that are older than
10 days, but exclude directories owned by certain users. I would need to run as a cron job once a week.
Thank you
-John (2 Replies)
Discussion started by: jbeaulau
2 Replies
LEARN ABOUT CENTOS
test::notabs
Test::NoTabs(3) User Contributed Perl Documentation Test::NoTabs(3)NAME
Test::NoTabs - Check the presence of tabs in your project
SYNOPSIS
"Test::NoTabs" lets you check the presence of tabs in your perl code. It report its results in standard "Test::Simple" fashion:
use Test::NoTabs tests => 1;
notabs_ok( 'lib/Module.pm', 'Module is tab free');
Module authors can include the following in a t/notabs.t and have "Test::NoTabs" automatically find and check all perl files in a module
distribution:
use Test::NoTabs;
all_perl_files_ok();
or
use Test::NoTabs;
all_perl_files_ok( @mydirs );
DESCRIPTION
This module scans your project/distribution for any perl files (scripts, modules, etc) for the presence of tabs.
EXPORT
A list of functions that can be exported. You can delete this section if you don't export anything, such as for a purely object-oriented
module.
FUNCTIONS
all_perl_files_ok( [ @directories ] )
Applies "notabs_ok()" to all perl files found in @directories (and sub directories). If no <@directories> is given, the starting point is
one level above the current running script, that should cover all the files of a typical CPAN distribution. A perl file is *.pl or *.pm or
*.t or a file starting with "#!...perl"
If the test plan is defined:
use Test::NoTabs tests => 3;
all_perl_files_ok();
the total number of files tested must be specified.
notabs_ok( $file [, $text] )
Run a tab check on $file. For a module, the path (lib/My/Module.pm) or the name (My::Module) can be both used.
AUTHOR
Nick Gerakines, "<nick at socklabs.com>"
BUGS
Please report any bugs or feature requests to "bug-test-notabs at rt.cpan.org", or through the web interface at
<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-NoTabs>. I will be notified, and then you'll automatically be notified of progress on
your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Test::NoTabs
You can also look for information at:
o AnnoCPAN: Annotated CPAN documentation
<http://annocpan.org/dist/Test-NoTabs>
o CPAN Ratings
<http://cpanratings.perl.org/d/Test-NoTabs>
o RT: CPAN's request tracker
<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Test-NoTabs>
o Search CPAN
<http://search.cpan.org/dist/Test-NoTabs>
ACKNOWLEDGEMENTS
Inspired by some code written by Paul Lindner.
Test::Strict was used as an example when creating this module and distribution.
Rick Myers and Emanuele Zeppieri also provided valuable feedback.
Patch to fix warnings provided by Florian Ragwitz (rafl)
Currently maintained by Tomas Doran (t0m) "bobtfish@bobtfish.net"
SEE ALSO
Test::More, Test::Pod. Test::Distribution, <Test:NoWarnings>
COPYRIGHT & LICENSE
Copyright 2006 Nick Gerakines, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.16.3 2012-06-25 Test::NoTabs(3)