I Want to remove all the sub-directories except latest five in any given TGTDIR.
Is there a way to do so without making a cd to TGTDIR?
I have tried the following but not worked.
Thank you.
What operating system and shell are you using?
In what way did it not work?
Are there any files other than directories in the directory named by $TGTDIR? Could non-directory files in $TGTDIR be related to why your command did not work?
Do any filenames in $TGTDIR contain any whitespace characters (i.e., <space>, <tab>, <newline>, <carriage-return>, or <form-feed>)?
This User Gave Thanks to Don Cragun For This Post:
I'm trying to remove several directories which contains sun-dirs and files inside.
I used the command rm -r <dirname>
But, it always ask "examine file in directory <dirname> yes/no?" line by line.
So, i need to write "y" for every line.
How can i skip this step and remove all directories with... (9 Replies)
Hi
I have a directory with two subdirectories and also have a code like below to search files modified in last 2 minutes.
# ls
hello080909.txt inbox outbox
# find . -type f -mmin +2
./inbox/hello2080909.txt
./outbox/hi0080909.txt
./hello080909.txt
The above code just searches and... (3 Replies)
I Need help for one requirement,
I want to move the latest/Older file in the folder to another file. File have the datetimestamp in postfix.
Example:
Source Directory : \a
destination Directory : \a\b
File1 : xy_MMDDYYYYHHMM.txt (xy_032120101456.txt)
File2: xy_MMDDYYYYHHMM.txt... (1 Reply)
Hi,
I am a newbie in shell scripting. I have to copy a particular sub-directory (data) from a large no. of directories (all in the same folder) and paste them to another directory ( /home/hubble/data ) and then rename all the subdirectories (data) as the name of its parent directory.
please... (8 Replies)
My company has a policy that employees can't keep music on our servers so im looking for a line or script that I can run as part of a cron job that will remove all mp3's in the users home directories.
Does anyone have any idea how I might accomplish this? (3 Replies)
Assume I want to remove a whole directory tree beginning with /foo/bar/
The directory or sub-directories may contain files.
The top directory /foo/bar/ itself should not be deleted.
rm -f- r /foo/bar
does not work because it requires a directory tree without files.
How does it work... (3 Replies)
hi
pls give me a script to compress all directories inside a directory and remove the original uncompressed version...
>>
please also tell the single commmand to uncompress all the directories back...whemn needed (2 Replies)
I need to write a script to :
list files with *.i extension in a directory and all its subdirectories + 30days old, save it in a file and then remove (2 Replies)
Hii,
Could someone help me to append string to the starting of all the filenames inside a directory but it should exclude .zip files and subdirectories.
Eg.
file1: test1.log
file2: test2.log
file3 test.zip
After running the script
file1: string_test1.log
file2: string_test2.log
file3:... (4 Replies)
Can anyone help me with a short command or script for the below scenario
there is a path,
/a/b/c/home??
Inside the above path there are number of subdirectories such as
one
two
three
four
i need to take all the subdirectories inside home?? with full path. i need only one level of... (4 Replies)
Discussion started by: Little
4 Replies
LEARN ABOUT OSX
inc::latest
inc::latest(3pm) Perl Programmers Reference Guide inc::latest(3pm)NAME
inc::latest - use modules bundled in inc/ if they are newer than installed ones
SYNOPSIS
# in Build.PL
use inc::latest 'Module::Build';
DESCRIPTION
The "inc::latest" module helps bootstrap configure-time dependencies for CPAN distributions. These dependencies get bundled into the "inc"
directory within a distribution and are used by Build.PL (or Makefile.PL).
Arguments to "inc::latest" are module names that are checked against both the current @INC array and against specially-named directories in
"inc". If the bundled verison is newer than the installed one (or the module isn't installed, then, the bundled directory is added to the
start of <@INC> and the module is loaded from there.
There are actually two variations of "inc::latest" -- one for authors and one for the "inc" directory. For distribution authors, the
"inc::latest" installed in the system will record modules loaded via "inc::latest" and can be used to create the bundled files in "inc",
including writing the second variation as "inc/latest.pm".
This second "inc::latest" is the one that is loaded in a distribution being installed (e.g. from Build.PL). This bundled "inc::latest" is
the one that determines which module to load.
Special notes on bundling
The "inc::latest" module creates bundled directories based on the packlist file of an installed distribution. Even though "inc::latest"
takes module name arguments, it is better to think of it as bundling and making available entire distributions. When a module is loaded
through "inc::latest", it looks in all bundled distributions in "inc/" for a newer module than can be found in the existing @INC array.
Thus, the module-name provided should usually be the "top-level" module name of a distribution, though this is not strictly required. For
example, Module::Build has a number of heuristics to map module names to packlists, allowing users to do things like this:
use inc::latest 'Devel::AssertOS::Unix';
even though Devel::AssertOS::Unix is contained within the Devel-CheckOS distribution.
At the current time, packlists are required. Thus, bundling dual-core modules may require a 'forced install' over versions in the latest
version of perl in order to create the necessary packlist for bundling.
USAGE
When calling "use", the bundled "inc::latest" takes a single module name and optional arguments to pass to that module's own import method.
use 'inc::latest' 'Foo::Bar' qw/foo bar baz/;
Author-mode
You are in author-mode inc::latest if any of the Author-mode methods are available. For example:
if ( inc::latest->can('write') ) {
inc::latest->write('inc');
}
loaded_modules()
my @list = inc::latest->loaded_modules;
This takes no arguments and always returns a list of module names requested for loading via "use inc::latest 'MODULE'", regardless of
wether the load was successful or not.
write()
inc::latest->write( 'inc' );
This writes the bundled version of inc::latest to the directory name given as an argument. It almost all cases, it should be '"inc"'.
bundle_module()
for my $mod ( inc::latest->loaded_modules ) {
inc::latest->bundle_module($mod, $dir);
}
If $mod corresponds to a packlist, then this function creates a specially-named directory in $dir and copies all .pm files from the
modlist to the new directory (which almost always should just be 'inc'). For example, if Foo::Bar is the name of the module, and $dir
is 'inc', then the directory would be 'inc/inc_Foo-Bar' and contain files like this:
inc/inc_Foo-Bar/Foo/Bar.pm
Currently, $mod must have a packlist. If this is not the case (e.g. for a dual-core module), then the bundling will fail. You may be
able to create a packlist by forced installing the module on top of the version that came with core Perl.
As bundled in inc/
All methods are private. Only the "import" method is public.
AUTHOR
Eric Wilhelm <ewilhelm@cpan.org>, David Golden <dagolden@cpan.org>
COPYRIGHT
Copyright (c) 2009 by Eric Wilhelm and David Golden
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
Module::Build
perl v5.16.2 2012-10-25 inc::latest(3pm)