Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Copying folders with only certain files Post 302935995 by derekludwig on Saturday 21st of February 2015 09:17:42 AM
Old 02-21-2015
Do you have to worry about name collisions, where FolderA and FolderB each contain SubfolderNN?

Also, your method copies everything and then deletes what you don't want. How about just copying what you want:
Code:
for dir in Folder1 Folder2 Folder3; do
  cd ${dir}
  find . -type f \( -name File1 -o ... -o -name FileN \) -print0 | cpio -p0dmu ../Folder4
  cd ..
done

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Copying Folders without some folders... ;-)

I am in a fix....... I have to write a backup script to backup say Folder A. Folder A contains n folders 1,2 ,3 .....n. my script should copy A without folder 2 & 3. Is there anyway I can do it without writing individual copy commands???? Please help.... (5 Replies)
Discussion started by: chimpu
5 Replies

2. Shell Programming and Scripting

Copying specific files from remote m/c to specific folders

Hi All, I am trying to rsync some of the latest files from remote m/c to my local linux box. Folder structure in my remote m/c looks like this /pub/Nightly/Package/ROLL/WIN /pub/Nightly/Package/SOLL/sol /pub/Nightly/Package/SOLL/linux Each of the folder contains gzip files which on daily... (0 Replies)
Discussion started by: jhoomsharabi
0 Replies

3. UNIX for Dummies Questions & Answers

Copying multiple folders to local machine (don't know folder names)

Hi. I'm trying to copy multiple folders from the remote machine to the local machine. I wrote a batch file to run an ftp window. The problem I am having is that the only command to copy files is mget *, and this copies only files, not folders. For example, ftp ts555 cd ts555/test ' test... (5 Replies)
Discussion started by: leenyburger
5 Replies

4. OS X (Apple)

Automated command ; extracting files from folders and copying them into a single folder

Hello everyone, I'm running Mac OS X Leopard (10.5.8) and I want to use the Terminal to help automate this tedious and laborious command for me: I need to extract all of the .m4p files in my "iTunes Music" folder which reside in folders of the artist, and then subfolders for the albums and... (2 Replies)
Discussion started by: qcom
2 Replies

5. UNIX for Dummies Questions & Answers

Searching for folders/parent folders not files.

Hello again, A little while back I got help with creating a command to search all directories and sub directories for files from daystart of day x. I'm wondering if there is a command that I've overlooked that may be able to search for / write folder names to an output file which ideally... (2 Replies)
Discussion started by: Aussiemick
2 Replies

6. Programming

Copying folders from one location to another..

Hi all, I need a suggestion in the following case, I have folder1, folder2 ,folder3 and file1 inside /home/test/source .. I need to copy all the folders and files to another location /home/test/destination Pls suggest any way to program this in C++.. :confused: (1 Reply)
Discussion started by: selvarajvs
1 Replies

7. UNIX for Advanced & Expert Users

Copying excluding some files and folders

I have a main folder. Inside that i have many(50) subfolders. In each subfolder, there are a no of large files(500 files ) present. I want to do copy operation for some files from some of the subfolders to /usr/tmp. I have the list of the subfolders and list of of files which i dont want to... (4 Replies)
Discussion started by: millan
4 Replies

8. Shell Programming and Scripting

Copying files from various folders to similar folder structure in another location

Hi, I need to write a script the has to copy the files from folders and subfolders to the same folder structure located in another location. Ex: mainfolder1 file1,file2,file3 subfolder1(file1,etc) subfolder2(file1,etc) to another folder location of same folder structure. rsync is not... (7 Replies)
Discussion started by: Raji Perumal
7 Replies

9. Shell Programming and Scripting

How to copy files/folders and show the files/folders?

Hi, So i know we use cp -r as a basic to copy folders/files. I would like this BUT i would like to show the output of the files being copied. With the amazing knowledge i have i have gone as far as this: 1) find source/* -exec cp -r {} target/ \; 2) for ObjectToBeCopied in `find... (6 Replies)
Discussion started by: Imre
6 Replies

10. Shell Programming and Scripting

Copying specific file types to specific folders

I am trying to write a script that cycles through a folder containing many folders and when inside each one it's supposed to copy all the .fna.gz files to a folder elsewhere if the file and the respective folder have the same name. for fldr in /home/playground/genomes/* ; do find .... (8 Replies)
Discussion started by: Mr_Keystrokes
8 Replies
FLIST(1)                                                             [nmh-1.5]                                                            FLIST(1)

NAME
flist, flists - list the number of messages in given sequence(s) SYNOPSIS
flist [+folder1 [+folder2 ...]] [-sequence name1 [-sequence name2 ...]] [-all | -noall] [-showzero | -noshowzero] [-recurse | -norecurse] [-fast | -nofast] [-alpha | -noalpha] [-version] [-help] flists is equivalent to flist -all DESCRIPTION
Flist is used to search a list of folders and display the number of messages in these folders that are in a given sequence or set of sequences (for example the "unseen" sequence). This is especially useful if you use some mechanism such as slocal or procmail (typically in conjunction with rcvstore) to pre-sort your mail into different folders before you view it. By default, the command flist will search the current folder for the given sequence or sequences (usually "unseen"). If (possibly multi- ple) folders are specified on the command line with +folder, then all these folders are searched for the given sequence(s). Flist will display for each folder searched, the number of messages in each of the specified sequences, and the total number of messages. The option -sequence is used to specify the name of a sequence in which to search for. This option may be used multiple times to specify multiple sequences. If this is not given, then the default is to search for all the sequences specified by the "Unseen-Sequence" profile component. For more details about sequences, read the mh-sequence(5) man page. Typically, flist will produce a line for each sequence, for every folder that is searched, even those which do not contain any messages in the given sequence. Specifying -noshowzero will cause flist to print only those folder/sequence combinations such the folder has a non- zero number of messages in the given specified sequence. If -recurse is given, then for each folder that is search, flist will also recursively descend into those folders to search subfolders for the given sequence. If -fast is given, only the names of the folders searched will be displayed, and flist will suppress all other output. If this option is used in conjunction with -noshowzero, then flist will only print the names of those folders searched that contain messages in in at least one of the specified sequences. Multiple Folders If the option -all is given (and no folders are specified with +folder), then flist will search all the folders in the top level of the users nmh directory. These folders are all preceded by the read-only folders, which occur as "atr-cur-" entries in the user's nmh context. An example of the output of flist -all is: /work/Mail has 5 in sequence unseen (private); out of 46 inbox+ has 10 in sequence unseen ; out of 153 junklist has 0 in sequence unseen ; out of 63 postmaster has 1 in sequence unseen ; out of 3 The "+" after inbox indicates that it is the current folder. The "private" flag indicates that the given sequence for that folder is private. See the mh-sequence(5) man page for details about private sequences. If the option -all and +folder are both specified, then flist will search this folder, and all its first level subfolders for the given sequence. You may specify multiple folders in this way. If flist is invoked by a name ending with "s" (e.g. flists), then the switch -all is assumed by default. The sorting order for the listing is alphabetical (with -alpha), or in a priority order defined by the "Flist-Order" profile entry (with -noalpha). Each item in the "Flist-Order" is a folder name or a folder name pattern that uses * to match zero or more characters. Longer matching patterns have precedence over shorter matching patterns. For example: Flist-Order: personal petproject mh* * admin *junk This order puts a few interesting folders first, such as those with mail addressed to you personally, those about a pet project, and those about mh-related things. It places uninteresting folders at the end, and it puts everything else in the middle in alphabetical order. FILES
$HOME/.mh_profile The user profile PROFILE COMPONENTS
Path: To determine the user's nmh directory mh-sequences: File that contains public sequences Unseen-Sequence: The name of the unseen message sequence Flist-Order: To sort folders by priority SEE ALSO
folder(1), rcvstore(1), slocal(1), mh-sequence(5) DEFAULTS
`-sequence' defaults to Unseen-Sequence profile entry `-showzero' `-noall' `-norecurse' `-noalpha' `-nofast' CONTEXT
If +folder is given, it will become the current folder. If multiple folders are given, the last one specified will become the current folder. MH.6.8 11 June 2012 FLIST(1)
All times are GMT -4. The time now is 03:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy