Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Copying multiple directories at the same time using Unix Post 60411 by JPigford on Sunday 16th of January 2005 09:37:37 PM
Old 01-16-2005
Quote:
Originally Posted by Neo
You could try to use regular expressions in PERL or PHP.....

With a simply shell utility like cp, you will have difficulties because cp does not use regular expressions to match patterns....

Neo
I have no idea what that means.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

copying to multiple directories using wildcard

Can we copy a file to multiple directories using a single command line , i tried with * didnt work for me cp /tmp/a.kool /tmp/folder/*/keys/ I am tryn to copy a.kool file to all keys folder in /tmp folder. is something i am missing ? (4 Replies)
Discussion started by: logic0
4 Replies

2. UNIX for Dummies Questions & Answers

copying directories from NT server to Unix server (solaris 5.8)

I need to copy around 30 directories (each directory include one or more text file(s)) from NT server to Unix server at one go. For doing this what are the privillages i should have in both NT and Unix server. Please let me know which command i can use in shell prompt. TIA. (4 Replies)
Discussion started by: jhmr7
4 Replies

3. Shell Programming and Scripting

check if multiple directories exist else create missing directories

Hi , I 'm trying to check if multiple directories exist on a server, if not create the missing ones and print " creating missing directory. how to write this in a simple script, I have made my code complex if ; then taskStatus="Schema extract directory exists, checking if SQL,Count and... (7 Replies)
Discussion started by: ramky79
7 Replies

4. UNIX for Dummies Questions & Answers

Deleting multiple directories inside multiple directories

Hi, Very unfamiliar with unix/linux stuff. Our admin is on vacation so, need help very quickly. I have directories (eg 40001, 40002, etc) that each have one subdirectory (01). Each subdir 01 has multiple subdirs (001, 002, 003, etc). They are same in each dir. I need to keep the top and... (7 Replies)
Discussion started by: kkouraus1
7 Replies

5. Shell Programming and Scripting

listing directories and sub directories with time and name options

Hello all! I'm looking to list directories and sub-directories of a path, on this forum I found this command: find $path -type d -exec ls -ld {} \; The issue I have is that with a simple ls, the list is listed by name, and using -t I get it by time. How could I list directories and sub... (5 Replies)
Discussion started by: nomadvisuals
5 Replies

6. UNIX for Advanced & Expert Users

Help with Calculating time difference between many directories in UNIX

A report needs to come some what similar to this No of elements Stream Batch No Load time A B C D A,B,C im able to get quite easily wc -l /usr/local/intranet/areas/prod/output/SRGW_0?/*/MESSAGE_T.dat O/P of above command. A B C ... (1 Reply)
Discussion started by: peckenson
1 Replies

7. UNIX for Dummies Questions & Answers

copy file using unix in multiple directories

Hi All Genious, I want to copy a file name XYZ .In a directory /HOME/dir/IXOS1/dir1 which contain multiple directories named not in pattern want to copy the XYZ in all of the directories available on path /HOME/dir/IXOS1/dir1 . Thanks in advance . (2 Replies)
Discussion started by: mumakhij
2 Replies

8. UNIX for Dummies Questions & Answers

Copying Directories from one server to another

Hi, I have a requirement where I have to connect to another server and copy directories from one server to another Directories on the Source server look like below (YYYY-MM-DD- 1 to 23) drwxr-xr-x 2 test_user dmfmart 422 Sep 1 23:45 2014-09-01-18 drwxr-xr-x 2 test_user dmfmart ... (3 Replies)
Discussion started by: arunkesi
3 Replies

9. Shell Programming and Scripting

Copying multiple files and appending time stamp before file extension

Hi, I have multiple files that read: Asa.txt Bad.txt Gnu.txt And I want to rename them using awk to Asa_ddmmyytt.txt and so on ... If there is a single command or more efficient executable please share! Thanks! (4 Replies)
Discussion started by: Jesshelle David
4 Replies

10. UNIX for Beginners Questions & Answers

How to read multiple files at same time through UNIX scripting?

How to read multiple files at simultaneously? (1 Reply)
Discussion started by: Priyanka_M
1 Replies
File::NCopy(3pm)					User Contributed Perl Documentation					  File::NCopy(3pm)

NAME
File::NCopy - Deprecated module. Use File::Copy::Recursive instead. Copy file, file. Copy file[s] | dir[s], dir SYNOPSIS
use File::NCopy qw(copy); copy "file","other_file"; copy "file1","file2","file3","directory"; # we want to copy the directory recursively copy 1,"directory1","directory2"; copy 1,"file1","file2","directory1","file3","directory2","file4", "directory"; # can also use references to file handles, this is for backward # compatibility with File::Copy copy *FILE1,*FILE2; copy *FILE1,"file"; copy "file1",*FILE2; # we don't specify 1 as the first argument because we don't want to # copy directories recursively copy "*.c","*.pl","programs"; copy "*", "backup"; use File::NCopy; # the below are the default config values $file = File::NCopy->new( 'recursive' => 0, 'preserve' => 0, 'follow_links' => 0, 'force_write' => 0, 'set_permission' => &File::NCopy::u_chmod, 'file_check' => &File::NCopy::f_check, 'set_times' => &File::NCopy::s_times, ); set_permission will take two file names, the original to get the file permissions from and the new file to set the file permissions for. file_check takes two parameters, the file names to check the file to copy from and the file to copy to. I am using flock for Unix systems. Default for this is &File::NCopy::f_check. On Unix you can also use &File::NCopy::unix_check. This one compares the inode and device numbers. set_times is used if the preserve attribute is true. It preserves the access and modification time of the file and also attempts to set the owner of the file to the original owner. This can be useful in a script used by root, though enyone can preserve the access and modification times. This also takes two arguments. The file to get the stats from and apply the stats to. On Unix boxes you shouldn't need to worry. On other system you may want to supply your own sub references. $file = File::NCopy->new(recursive => 1); $file->copy "file","other_file"; $file->copy "directory1","directory2"; $file = File::NCopy->new(u_chmod => &my_chmod,f_check => &my_fcheck); $file->copy "directory1","directory2"; DESCRIPTION
File::NCopy::copy copies files to directories, or a single file to another file. You can also use a reference to a file handle if you wish whem doing a file to file copy. The functionality is very similar to cp. If the argument is a directory to directory copy and the recursive flag is set then it is done recursively like cp -R. In fact it behaves like cp on Unix for the most part. If called in array context, an array of successful copies is returned, otherwise the number of successful copies is returned. If passed a file handle, it's difficult to make sure the file we are copying isn't the same that we are copying to, since by opening the file in write mode it gets pooched. To avoid this use file names instead, if at all possible, especially for the to file. If passed a file handle, it is not closed when copy returns, files opened by copy are closed. copy Copies a file to another file. Or a file to a directory. Or multiple files and directories to another directory. Or a directory to another directory. Wildcard arguments are expanded, except for the last argument which should not be expanded. The file and directory permissions are set to the orginating file's permissions and if preserve is set the access and modification times are also set. If preserve is set then the uid and gid will also be attempted to be set, though this may only for for the men in white hats. In list context it returns all the names of the files/directories that were successfully copied. In scalar context it returns the number of successful copies made. A directory argument is considerd a single successful copy if it manages to copy anything at all. To make a directory to directory copy the recursive flag must be set. cp Just calls copy. It's there to be compatible with File::Copy. new If used then you can treat this as an object oriented module with some configuration abilities. recursive If used as an object then you can use this to set the recursive attribute. It can also be set when instantiating with new. The other attributes must all be set when instantiating the object. If it isn't specified then directories are not followed. preserve Attempt to preserve the last modification and access time as well as user and group id's. This is a useful feature for sysadmins, though the access and modification time should always be preservable, the uid and gid may not. follow_links If the link is to a directory and this attribute is true then the directory is followed and recursively copied. Otherwise a link is made to the root directory the link points to. eg. /sys/ is a link to /usr/src/sys/ is a link to /usr/src/i386/sys then the link /sys/ is actually created in the source directory as a link to /usr/src/i386/sys/ rather than /usr/src/sys/ since if the link /usr/src/sys/ is removed then we lost the link even though the directory we originally intended to link to still exists. force_write Force the writing of a file even if the permissions are read only on it. EXAMPLE
See SYNOPSIS. BUGS
When following links the target directory might not exactly the same as the source directory. The reason is that we have to make sure we don't follow circular or dead links. This is really a feature though the result may not quite resemble the source dir, the overall content will be the same. :) From Ken Healy (Version 0.34) On Win32, The use of backslash for paths is required. AUTHOR
Gabor Egressy gabor AT vmunix.com Copyright (c) 1998 Gabor Egressy. All rights reserved. All wrongs reversed. This program is free software; you can redistribute and/or modify it under the same terms as Perl itself. Some ideas gleaned from File::Copy by Aaron Sherman & Charles Bailey, but the code was written from scratch. Patch at versions 0.33, and 0.34 added by MZSANFORD. 0.35, 0.36 - Alexandr Ciornii (alexchorny AT gmail.com) perl v5.12.3 2011-06-18 File::NCopy(3pm)
All times are GMT -4. The time now is 07:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy