06-20-2010
copy all files with the same filenames as those in another folder
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, regardless of file extension, 100 .txt files in folder B share the same name as those 100 .jpg files, for example 00011020.jpg in folder A is able to find its corresponding 00011020.txt in folder B.
Now, my question is:
How to just copy out the 100 description .txt files that share the same name as those 100 image files, out from folder B into folder C( or create folder C first, and then carry out the copy) ?
Looking forward to your help.
Best Regards
JIA Pei
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
dear all,
i want to copy all files in my home dir to another.
from my home dir i have given ls -la then
some hidden files are there with dot . .. and i also want to copy all dirs in my home as it is . because iam upgrading the system
how to copy all files and dirs in my home dir... (1 Reply)
Discussion started by: rajan_ka1
1 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
hello, I need to build a shell script that receives the folder to copy by parameter and copy all files except thumb.db to another folder and rename them like, file.jpg renamed to file_bb1.jpg.
can someone help me
Thanks (4 Replies)
Discussion started by: zeker
4 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. 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
9. 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
10. Shell Programming and Scripting
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... (5 Replies)
Discussion started by: chlade
5 Replies
LEARN ABOUT ULTRIX
refile
refile(1mh) refile(1mh)
Name
refile - file message in other folders
Syntax
refile [ msgs ] [ +folder ] [ options ]
Description
Use the command to move the specified message from the current folder to another folder. You can refile messages in more than one folder
by giving multiple folder names as arguments.
If you do not specify a message, the current message is refiled. You can refile a message other than the current message by giving its
number as a msgs argument. You can also refile more than one message at a time by specifying more than one message number, or a range of
message numbers, or a message sequence. See for more information on sequences.
The current folder remains the same unless the -src option is specified; in that case, the source folder becomes current. Normally, the
last message specified becomes the current message. However, if the -link option is used, the current message is not changed.
If the Previous-Sequence: entry is set in the file, in addition to defining the named sequences from the source folder, will also define
those sequences for the destination folders. See for information concerning the previous sequence.
Options
-draft Refiles the draft message, or the current message in your folder, if you have one set up. You cannot give a msgs argument when
you use this option.
-file filename
Moves a file into a folder. This option takes a file from its directory and places it in the named folder, as the next message
in the folder. The file must be formatted as a legal mail message. This means that the message must have the minimum header
fields separated from the body of the message by a blank line or a line of dashes.
-help Prints a list of the valid options to this command.
-link
-nolink Keeps a copy of the message in the source folder. Normally, removes the messages from the original folder when it refiles them.
The -link option keeps a copy in the original folder, as well as filing a copy in the new folder.
-preserve
-nopreserve
Preserves the number of a message in the new folder. Normally, when a message is refiled in to another folder, it is set to the
next available number in that folder. The -preserve option keeps the number of the message the same in the new folder as it had
been in the old.
You cannot have two messages with the same number in one folder, so you should use this option with care.
-src +folder
Specifies the source folder to take messages from. Normally, messages are refiled from the current folder into another folder.
However, you can take messages from a different folder by using the -src +folder option to specify the alternative source folder.
Examples
The following example refiles messages 3 and 5 in the folder
% refile 3 5 +records
The next example files the current message into two folders:
% refile +jones +map
The next example takes message 13 in the current folder and refiles it in the folder. The message remains in the current folder as well as
appearing in the folder.
% refile -link 13 +test
The next example takes a message from the folder when it is not the current folder, and places it in the folder
% refile 3 -src +test +outbox
Profile Components
Path: To determine your Mail directory
Folder-Protect: To set protections when creating a new folder
rmmproc: Program to delete the message
Files
The user profile.
See Also
folder(1mh), mark(1mh), mh_profile(5mh)
refile(1mh)