hi all,
i'm looking for a bash or tcsh script that will clone an empty dir tree 'over' another tree ...
specifically, i'd like to:
(1) specify a src directory
(2) list the directory tree/hiearchy beneath that src dir, w/o files -- just the dirs
(3) clone that same, empty dir hierarchy to... (2 Replies)
Hi,
What will be the best way to do the follwing:
i have a file calld dir.list
/cav
/cav/brif
/usr/main
/cat
i want to run a script that will take each of the item in the file and create a new dir in a location that i'll choose
it nee to do mkdir cav
mkdir cav
cd cav
mkdir brif... (8 Replies)
hi
i have a script
compareFiles()
{
find /tmp/Satya -type f | \
while read filename1
do
echo "----------------------------------------$filename1"
find /tmp/Satya -type f | \
while read filename2
do
if diff $filename1 $filename2
then
echo "Both files... (3 Replies)
Hi, I am fairly new to writing scripts.
I am trying to write a script that moves either One or All of the files from one directory to another.
I know how to make the actual command to do it, but i don't quite know how to add operators to it, ie -i or -a.
I want -i to move one file from... (4 Replies)
HI all, I got a CPIO archive that contains a unix filesystem that I try to extract, but it extract to the root dir / unstead of current dir, and happily it detects my file are newer otherwise it would have overwrited my system's file!
I tried all these commands
cpio -i --make-directories <... (2 Replies)
Hey all,
i want to copy only the file names from an ftp server (directory and all sub directory) to a text file in another server (non ftp), i.e. i want to recursively move through directories and copy only the names to a text file.
any help is appreciated...thank you in advance (1 Reply)
I am very new to unix as well as shell scripting.
I have to write a script for the following requirement. In have to list all the files in directory and its sub directories along with file path and size of the file
Please help me in this regard and many thanks in advance. (3 Replies)
Dear Members,
I have a list of xml files like
abc.xml.table
prq.xml.table
...
..
.
in a txt file.
Now I have to search the file(s) in all directories and sub-directories and print the full path of file in a output txt file.
Please help me with the script or command to do so.
... (11 Replies)
I have searched this quite a long time but couldn't find the right method for me to use. I need to assign read write permission to the user for specific directories and it's sub directories and files. I do not want to use ACL. I do not want to assign user the same group of that directories too.... (0 Replies)
Discussion started by: blinkingdan
0 Replies
LEARN ABOUT MOJAVE
io::dir
IO::Dir(3pm) Perl Programmers Reference Guide IO::Dir(3pm)NAME
IO::Dir - supply object methods for directory handles
SYNOPSIS
use IO::Dir;
$d = IO::Dir->new(".");
if (defined $d) {
while (defined($_ = $d->read)) { something($_); }
$d->rewind;
while (defined($_ = $d->read)) { something_else($_); }
undef $d;
}
tie %dir, 'IO::Dir', ".";
foreach (keys %dir) {
print $_, " " , $dir{$_}->size,"
";
}
DESCRIPTION
The "IO::Dir" package provides two interfaces to perl's directory reading routines.
The first interface is an object approach. "IO::Dir" provides an object constructor and methods, which are just wrappers around perl's
built in directory reading routines.
new ( [ DIRNAME ] )
"new" is the constructor for "IO::Dir" objects. It accepts one optional argument which, if given, "new" will pass to "open"
The following methods are wrappers for the directory related functions built into perl (the trailing 'dir' has been removed from the
names). See perlfunc for details of these functions.
open ( DIRNAME )
read ()
seek ( POS )
tell ()
rewind ()
close ()
"IO::Dir" also provides an interface to reading directories via a tied hash. The tied hash extends the interface beyond just the directory
reading routines by the use of "lstat", from the "File::stat" package, "unlink", "rmdir" and "utime".
tie %hash, 'IO::Dir', DIRNAME [, OPTIONS ]
The keys of the hash will be the names of the entries in the directory. Reading a value from the hash will be the result of calling
"File::stat::lstat". Deleting an element from the hash will delete the corresponding file or subdirectory, provided that "DIR_UNLINK" is
included in the "OPTIONS".
Assigning to an entry in the hash will cause the time stamps of the file to be modified. If the file does not exist then it will be
created. Assigning a single integer to a hash element will cause both the access and modification times to be changed to that value.
Alternatively a reference to an array of two values can be passed. The first array element will be used to set the access time and the
second element will be used to set the modification time.
SEE ALSO
File::stat
AUTHOR
Graham Barr. Currently maintained by the Perl Porters. Please report all bugs to <perlbug@perl.org>.
COPYRIGHT
Copyright (c) 1997-2003 Graham Barr <gbarr@pobox.com>. 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.18.2 2013-11-04 IO::Dir(3pm)