09-19-2013
How to copy files with the same filenames as those in another folder to that same folder?
Hello All
A similar question like this was asked before but I need to change part of the question.
I've two folders, Folder A contains some image files in 150 subfolders;
Folder B contains text files in 350 subfolders.
All image files in Folder A have the same filename as the text files in Folder B.
That is to say, regardless of file extension, 10000.txt files in subfolders of Folder B share the same filename as 10000.tif files in subfolders of Folder A. For example 00011020.tif in subfolder 0120 of Folder A is able to find its corresponding 00011020.txt file in subfolder 0300 of Folder B. So same filename are not in the corresponding subfolders.
My question is:
How to copy the text files that share the same filename as those image files to the corresponding subfolders in Folder A. I want to combine all files in the subfolders of Folder A.
Thanks in advance for your help.
Chlade
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
For example,
/tmp/folder1
includes /tmp/folder1/a /tmp/folder1/b
/tmp/folder2
includes /tmp/c
Is there a command without removing files in /tmp/folder2 first to copy the /tmp/folder1 to /tmp/folder2?
and the result should be
/tmp/folder2 will include only /tmp/folder2/a... (2 Replies)
Discussion started by: lalelle
2 Replies
2. UNIX for Advanced & Expert Users
Hello all,
I'm trying to accomplish that if a file gets written to folder /path/to/a/ it gets automatically copied into /path/to/b/ the moment its get written.
I thought of writing a shell script and cron it that every X amount of minutes it copies these files over but this will not help me... (2 Replies)
Discussion started by: Bashar
2 Replies
3. Shell Programming and Scripting
Hi all,
*I use Uwin and Cygwin emulator.
I´m trying to search for all text files in the current folder (C/Files) and its sub folders using
find -depth -name "*.txt"
The above command worked for me, but now I would like to copy all found text files to a new folder (C/Files/Text) with ... (4 Replies)
Discussion started by: cgkmal
4 Replies
4. Shell Programming and Scripting
Hi, all:
I've got two folders, folder A contains some image files (say, 100 files) in .jpg format;
folder B contains all description files (say, 500 files) in .txt format.
All image files in folder A are able to find their corresponding description files in folder B.
That is to say,... (3 Replies)
Discussion started by: jiapei100
3 Replies
5. Shell Programming and Scripting
Hi everyone,
when I try to copy *.gz files run cp within the correct source folder it works as follow:
Source folder = C:/Documents and Settings/user/Recent papers/2771/
Destination folder = C:/Documents and Settings/user/My documents/1532/temp
cp *.gz "C:/Documents and Settings/user/My... (2 Replies)
Discussion started by: cgkmal
2 Replies
6. UNIX for Dummies Questions & Answers
Hi ,
I have a file like this, i need to trace its path and copy the files from its path to one folder. I need to replace elib.com,melib.com to F:\.Here i need to copy to a folder called image. Please help
http://elib.com/SHC/NLNLHB/020001498.pdf ... (4 Replies)
Discussion started by: umapearl
4 Replies
7. Shell Programming and Scripting
This has been tearing my hair out.
I need to:
1: compare server1:/data/archive/ to server2:/data/archive/ (through rsync, ssh, etc)
2: filenames that don't match, get copied (scp) to server2:/data/
server1 and server2 have ssh, scp, rsync access between eachother.
Is there any option in... (3 Replies)
Discussion started by: damang111
3 Replies
8. Shell Programming and Scripting
Hi experts,
I am coming to you with this basic question on copying a folder and its content from one location to another folder using PERL script.
This is my requirement.
I have a folder AB under /users/myhome
I want to copy AB and its contents to /user/workspace.
Finally it should... (1 Reply)
Discussion started by: amvarma77
1 Replies
9. UNIX for Dummies Questions & Answers
Hi,
I have a folder which contains some files like this.
bin.000001
bin.000002
bin.000003
bin.000004
bin.000005
bin.000129
bin.index
I want to copy all these files to a new folder except the last files.
Please provide some ideas.
Please use next time code tags for your code... (6 Replies)
Discussion started by: arijitsaha
6 Replies
10. Shell Programming and Scripting
hello
does someone want to help me for this one ?
i want to rename files & a folder according to the similarities in filenames
for example :
the file with the good name
cglogo tougl1953 dgmel bogd 01 -- ttgductoog ggdté gollogtd.ext1the others files needed to be renamed
cglogo... (5 Replies)
Discussion started by: mc2z674gj
5 Replies
LEARN ABOUT ULTRIX
folders
folders(1mh) folders(1mh)
Name
folders - list folders and contents
Syntax
folders [ +folder ] [ msg ] [ options ]
Description
The command displays the names of your folders and the number of messages that they each contain.
The command displays a list of all the folders in your Mail directory. The folders are sorted alphabetically, each on its own line. This
is illustrated in the following example:
Folder # of messages ( range ); cur msg (other files)
V2.3 has 3 messages ( 1- 3).
adrian has 20 messages ( 1- 20); cur= 2.
brian has 16 messages ( 1- 16).
chris has 12 messages ( 1- 12).
copylog has 242 messages ( 1- 242); cur= 225.
inbox+ has 73 messages ( 1- 127); cur= 127.
int has 4 messages ( 1- 4); cur= 2 (others).
jack has 17 messages ( 1- 17); cur= 17.
TOTAL= 387 messages in 8 folders.
The plus sign (+) after inbox indicates that it is the current folder. The information about the folder includes the term (others). This
indicates that the folder contains files which are not messages. These files may be either sub-folders, or files that do not belong under
the MH file naming scheme.
The command is identical to the effect of using the -all option to the command.
If you use with the +folder argument, it will display all the subfolders within the named folder. as shown in the following example:
% folders +test
Folder # of messages ( range ); cur msg (other files)
test+ has 18 messages ( 1- 18); (others).
test/testone has 1 message ( 1- 1).
test/testtwo has no messages.
TOTAL= 19 messages in 3 folders.
See for more details of sub-folders.
Options
-fast
-nofast Lists only the name of folders, with no additional information. This is faster because the folders need not be read.
-help Prints a list of the valid options to this command.
-list
-nolist Lists the contents of the folder-stack. No +folder argument is allowed with this option.
-pack
-nopack Re-numbers messages in the folders. Messages are re-numbered sequentially, and any gaps in the numbering are removed. The
default operation is -nopack, which does not change the numbering in the folder.
-pop Discards the top of the folder-stack, after setting the current folder to that value. No +folder argument is allowed with this
option. This corresponds to the operation in the C-shell; see The -push and -pop options are mutually exclusive: the last occur-
rence of either one overrides any previous occurrence of the other.
-push Pushes the current folder onto the folder-stack, and makes the +folder argument into the current folder. If +folder is not
given, the current folder and the top of the folder-stack are exchanged. This corresponds to the operation in the C-shell; see
The -push switch and the -pop switch are mutually exclusive: the last occurrence of either one overrides any previous occurrence
of the other.
-recurse
-norecurse
Lists folders recursively. Information on each folder is displayed, followed by information on any sub-folders which it con-
tains.
-total
-nototal Displays only the total number of messages and folders in your Mail directory. This option does not print any information about
individual folders. It can be suppressed using the -nototal option.
The defaults for are:
+folder defaults to all
msg defaults to none
-nofast
-noheader
-nototal
-nopack
-norecurse
Restrictions
MH does not allow you to have more than 100 folders at any level in your Mail directory.
Profile Components
Path: To determine your MH directory
Folder-Protect: To set protections when creating a new folder
Folder-Stack: To determine the folder stack
lsproc: Program to list the contents of a folder
Files
The user profile.
See Also
csh(1), folder(1mh), refile(1mh), mhpath(1mh)
folders(1mh)